Пример #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $data = Comments::where('post_id', $id)->orderBy('created_at', 'desc')->get();
     return response()->json($data);
 }
Пример #2
0
$router->bind('profile', function ($user_name) {
    $user = \App\Models\User::where('user_name', $user_name)->first();
    if (!$user) {
        $user = \App\Models\User::where('user_name', Auth::user()->user_name)->first();
    }
    return \ZaWeb\Profile\Models\Profile::where('user_id', $user->id)->first();
});
/**
 * COMMENTS
 */
Route::model('comments', 'App\\Models\\Comments');
//->
Route::resource('comments', 'CommentsController');
//->
$router->bind('comments', function ($ads_id) {
    return \App\Models\Comments::where('ads_id', 21)->first();
});
/**
 * Services
 */
Route::resource('services', 'ServicesController');
/**
 *
 * Static page
 */
$router->get('/page/{spage}', ['uses' => 'StaticPageController@index', 'as' => 'static-page']);
$router->bind('spage', function ($slug) {
    return \App\Models\StaticPage::where('slug', '=', $slug)->firstOrFail();
});
/**
 *