예제 #1
0
 /**
  * Display a listing of the resource.
  * @param $request
  * @return Response
  */
 public function index(Request $request)
 {
     if ($request->get('project_id', false)) {
         $destinations = Destination::where('project_id', $request->get('project_id'))->orderBy('sort', 'asc')->get();
         return response()->json($destinations);
     } else {
         return abort(500, 'Не указан проект');
     }
 }
예제 #2
0
 public function getDestinations()
 {
     if (!empty($this->project_id)) {
         return \App\Destination::where('project_id', '=', $this->project_id)->orderBy('sort')->get(['title', 'email']);
     } else {
         return null;
     }
 }
예제 #3
0
 /**
  * Passing data to view
  *
  * @return \Illuminate\Http\Response
  */
 public function showAll()
 {
     $news2 = DB::table('news')->leftJoin('users', 'news.publisher', '=', 'users.id')->leftJoin('news_categories', 'news.category', '=', 'news_categories.id')->select('news.title', 'news.slug', 'news_categories.name as category', 'news.s_content', 'users.name as publisher', 'news.image', 'news.created_at', 'users.image as image2')->get();
     $destination = Destination::where('id', '!=', 'null')->get();
     return view('frontend.destination.index')->with(['destination' => $destination, 'news2' => $news2]);
 }