Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel - Controller get select value from Views

public function index(Request $request)
    {
        $locale = Request::segment(1);
        $view = 'home';
        $article_year = $request->get('article_year');

        $data['year'] = (new Catalog())->where('catalog_type_id', 3)->where('is_active', 1)->orderBy('sort_num', 'asc')->get();
        $data['news_pin'] = (new Article())->where('is_active', 1)->where('user_year', $article_year)->orderBy('sort_num', 'desc')->get();
        $data['news'] = (new Article())->where('is_active', 0)->where('user_year', $article_year)->orderBy('sort_num', 'desc')->get();       

        return view($view, $data);
    }

//and

use IlluminateHttpRequest;
 
PREVIOUS NEXT
Tagged: #Laravel #Controller #select #Views
ADD COMMENT
Topic
Name
5+5 =