예제 #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (Auth::user()) {
         $types = \App\Type::orderBy('name', 'asc')->get();
         return view('jobs.create', compact('types'));
     }
     return redirect('login');
 }
예제 #2
0
 /**
 	 query responsibility
 */
 public function getPractice()
 {
     //this returns the collection
     $type = \App\Type::orderBy('id', 'DESC')->get();
     //now $type is the collection, and we can work from within that, like so.
     $first = $type->first();
     dump($type);
     dump($first);
 }
예제 #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $search = \Request::get('search');
     $getCategory = \Request::get('category');
     if (is_null($search) || is_null($getCategory) || $search == "" || $getCategory == "") {
         $types = Type::orderBy('id', 'DESC')->paginate(10);
     } else {
         $types = Type::where($getCategory, 'like', '%' . $search . '%')->orderBy($getCategory)->paginate(1000);
     }
     $category = array('' => 'kategori', 'name' => 'Nama');
     return view('type.index', compact('types', 'category'));
 }
예제 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $types = Type::orderBy('name', 'asc')->get();
     return view('types.index', compact('types'));
 }