mardi 16 février 2021

Laravel 5 insert works without $fillable

i hope my question is not stupid, but i have a laravel application made by someone else.

In the controller i have this:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Result;

class StoreInDB extends Controller
{
    function store($uuid, $session){
        // Insert data
        $r = new Result;
        if($r->updateOrInsert(['user_id' => $uuid], ['user_id' => $uuid, 'answers' => $session])){
            return true;
        }
        else{
            return false;
        }
    }
}

In the Model Result i have this:

namespace App;

use Illuminate\Database\Eloquent\Model;

class Result extends Model
{
    //
}

Why does it works ? There is no $fillable to tell wich column can be used to insert.

Datas are inserted. But why? The only issue i have is that created_at and updated_at are null.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3qlPRyC
via IFTTT

Aucun commentaire:

Enregistrer un commentaire