dimanche 3 septembre 2017

Laravel Foreign Key Guarded or Fillable

I am trying to develop a Restful API with Laravel 5 and i have a table as below

Schema::create('reports', function (Blueprint $table) {
    $table->increments('id');
    $table->string('company_name');
    $table->string('direction');
    $table->integer('user_id')->unsigned();
    $table->timestamps();
});

The field user_id is a foreign key and i want to create a new Report record when make a POST request via Android App.

My question is, what should be the status of user_id field ? Guarded or fillable ?

Any help would be appreciated



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire