Проблема, с которой я столкнулся, заключается в том, что я не могу найти правильный способ общего создания новой модели, как я обычно делаю: $mymodel = new Mymodel();
Здесь является соответствующей частью функции. Он не работает, и я уже покопался в коде в папке Illuminate\Database
Код: Выделить всё
// lets get the model and then we update and save
$model = DB::table($request->input("model")."s")->where('id',$request->input("id"))->first();
if(!$model){
$model = DB::table($request->input("model")."s")->new();
}
// This part is not tested yet, but this part should set all the
// values from an Array of JSON objects, I will get that part to work
foreach(json_decode($request->input("values")) as $value){
$model->attributes[$value->name] = $value->value;
}
Подробнее здесь: https://stackoverflow.com/questions/491 ... aravel-5-x
Мобильная версия