User::with('roles')->find(1);
public function view()
{
$posts = DB::table('posts')
->select('*')
->get('*');
return Response::json([
'posts' => array_map(function($post) {
return [
'title'=>$post->title,
'datatime'=>$post->datetime,
'anons'=>$post->anons,
'text'=>$post->text,
'tags'=>explode(', ', $post->tags),
'image'=>$post->images
];
}, $posts)
]);
}
class Controller
{
public function index(Request $request)
{
return (new Service($request->get('type'), $request->get('param')))->run();
}
}
'middleware' => 'throttle:1,5'
1 - сколько раз, 5 - сколько минут таймаут APP_DEBUG=true
и посмотрите подробнее.$post = Post::findOrFail($id);
$post->user()->sync([]);
$post->delete();
$post = Post::findOrFail($id);
$post->user()->delete();
$post->delete();
Schema::create('users_posts', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->integer('post_id')->unsigned()->index();
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
});
league/omnipay
league/omnipay