<file_sep>class CreateElementCWController{
    constructor(API, ToastService){
        'ngInject';

        this.API = API;
        this.ToastService = ToastService;


    }

    $onInit(){

        this.deleteNote();

    }
    deleteNote(){
        this.title="";
        this.photo="";
        this.note="";

    }


    save(){
        var data = {
            title: this.title,
            note: this.note,
            photo: this.photo.base64
        };

        this.API.all('create-element').post(data).then((response) => {
            this.ToastService.show('Élément ajouté !');
    });
    }
}

export const CreateElementCWComponent = {
    templateUrl: './views/app/components/create-element-CW/create-element-CW.component.html',
    controller: CreateElementCWController,
    controllerAs: 'vm',
    bindings: {}
}
<file_sep>"# laravel-angular-material" 
"# laravel-angular-material-NPA-tinymce" 
<file_sep><?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Element;
use App\Http\Requests;
use DB;

class CWElementController extends Controller
{   
    public function create(Request $request)
    {
       $this->validate($request, [
         'title'  => 'required',
         'note' => 'required',
         'photo' => 'required',
       ]);
        
       $post = new Element;
       $post->title = $request->input('title');
       $post->note = $request->input('note');
       $post->photo = $request->input('photo');
       
       $post->save();

       return response()->success(compact('element'));
    }

    public function get()
    {
        $elements = Element::get();

        return response()
        ->success(compact('elements'));
    }
    public function delete(Request $request)
    {
        $id = $request->input('id');
        return Element::destroy($id);
    }
}
<file_sep><?php
namespace App\Modal;

use Illuminate\Database\Eloquent\Model;

use Carbon\Carbon;


class Evaluate extends Model
{
    protected $table = 'evaluates';

    public function users()
    {
        return $this->belongsTo('App\Modal\User');
    }
    public function themes()
    {
        return $this->belongsTo('App\Modal\Theme');
    }

    public function questions()
    {
        return $this->belongsTo('App\Modal\Question');
    }
}
