Код: Выделить всё
use App\Http\Controllers\Controller;
use App\Models\Admin\Services\Bundle;
class BundleController extends Controller
{
public function changeStatus($id)
{
try
{
$bundle = Bundle::find($id);
$bundle->update(['status' => false]);
return redirect()->route('admin_bundle.index');
} catch (\Exception $exception)
{
return response()->json(['status'=>'error', 'error'=> $exception->getMessage()]);
}
}
}
< /code>
Файл модели :: < /p>
class Bundle extends Model
{
protected $fillable = [
'name', 'description', 'remarks', 'image_path', 'status'
];
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... ler-method
Мобильная версия