123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Http\Controllers\Client;
- use Illuminate\Http\Request;
- use App\Http\Requests;
- use App\Http\Controllers\Controller;
- use App\Models\Task;
- use App\Models\Note;
- use App\Models\AssignProject;
- use Auth;
- use App\Models\Ticket;
- class ClientController extends Controller
- {
- public function index(){
- return "Client Profile";
- }
- public function client_dashboard(){
- $data['title'] = "Client dashboard";
- $user_id = Auth::user()->id;
- $data['notes'] = Note::where('user_id',$user_id)->orderBy('time')->get();
- $chk = AssignProject::where('user_id',$user_id)->distinct('proj_id')->get();
- $proj_id_ary = array();
- if(count($chk) > 0)
- {
- foreach($chk as $info)
- {
- array_push($proj_id_ary, $info->proj_id);
- }
- $data['created_task'] = Task::whereIn('proj_id',$proj_id_ary)->where('status',1)->get();
- $data['inprocess_task'] = Task::whereIn('proj_id',$proj_id_ary)->where('status',2)->get();
- }
- $client_id=\Auth::user()->id;
-
- if(\Auth::user()->utype==3)
- {
- $data['tickets']=Ticket::with(['user','created_user'])->where('client_id',$client_id)->orderBy('id','desc')->get();
-
- } else {
- $data['tickets']=Ticket::with(['user','created_user'])->orderBy('id','desc')->get();
- }
-
- return view('client.client_dashboard',$data);
- }
- }
|