コード例 #1
0
ファイル: HomeController.php プロジェクト: laravelista/kyle
 /**
  * Show the report for all things.
  *
  * @return [type]
  */
 public function report()
 {
     $services = Service::orderBy('month')->orderBy('day')->where('active', 1)->with(['client', 'category'])->get();
     $clients = Client::orderBy('name')->whereHas('services', function ($query) {
         $query->where('active', 1);
     })->with(['services' => function ($query) {
         $query->where('active', 1);
     }])->get();
     $categories = Category::orderBy('name')->whereHas('services', function ($query) {
         $query->where('active', 1);
     })->with(['services' => function ($query) {
         $query->where('active', 1);
     }])->get();
     return view('report')->with(compact('services', 'clients', 'categories'));
 }
コード例 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $services = Service::orderBy('created_at', 'DESC')->paginate(9);
     return view('services.index')->with('services', $services)->with('title', trans('titles.services'));
 }
コード例 #3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $developers = User::orderBy('name', 'ASC')->where('role', 'developer')->lists('name', 'id');
     $services = Service::orderBy('name', 'ASC')->lists('name', 'id');
     $costumers = User::orderBy('name', 'ASC')->where('role', 'customer')->lists('name', 'id');
     $project = Project::findOrFail($id);
     $role = Auth::user()->role;
     if ($role == 'developer' || $role == 'agent' || $role == 'customer') {
         return view('agent/projects/edit', compact('project', 'developers', 'services'));
     } elseif ($role == 'admin') {
         return view('projects/edit', compact('project', 'developers', 'services', 'costumers'));
     }
 }
コード例 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function home()
 {
     $services = Service::orderBy('created_at', 'DESC')->take(6)->get();
     $materials = Material::orderBy('created_at', 'DESC')->take(6)->get();
     return view('home')->with('services', $services)->with('materials', $materials)->with('title', trans('titles.home'));
 }
コード例 #5
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $services = Service::orderBy('month')->orderBy('day')->with(['client', 'category'])->get();
     return view('services.index')->with(compact('services'));
 }