/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { /** * Display the list of Unassigned works !!! */ $unAssignedWorks = DB::table('works as w')->leftJoin('department_works as dw', 'dw.id', '=', 'w.last_department_work_id')->leftJoin('user_works as uw', 'uw.id', '=', 'dw.last_user_work_id')->leftJoin('users as u', 'uw.assigned_to', '=', 'u.id')->leftJoin('users as us', 'w.created_by', '=', 'us.id')->leftJoin('departments as d', 'd.id', '=', 'dw.department_id'); if ($this->userWithDepartment->department[0]->pivot->is_senior == 1) { $unAssignedWorks = $unAssignedWorks->where(['dw.department_id' => $this->userWithDepartment->department[0]->id, 'dw.accepted' => 0]); $unAssignedWorks = $unAssignedWorks->orWhere(['uw.accepted' => -1, 'dw.department_id' => $this->userWithDepartment->department[0]->id, 'dw.accepted' => 0, 'dw.accepted' => 1]); } $unAssignedWorks = $unAssignedWorks->orWhere(['w.created_by' => $this->currentUser->getId(), 'w.last_department_work_id' => null]); $unAssignedWorks = $unAssignedWorks->orWhere(['w.created_by' => $this->currentUser->getId(), 'dw.accepted' => -1])->select(['w.id', 'w.deadline as deadline', 'w.deadline as deadline', 'w.slug', 'w.title', 'w.description', 'w.importance', DB::raw('CONCAT(us.first_name," ",us.last_name) as created_by'), 'd.name as department_name', DB::raw('CONCAT(u.first_name," ",u.last_name) as assigned_to'), 'uw.accepted as user_work_accepted', 'dw.accepted as department_work_accepted', 'dw.department_id as department_id', 'w.created_by as created_by', 'uw.accepted as user_work_accepted'])->orderBy('w.created_at', 'desc')->paginate(15, ['*'], 'unAssignedWorks'); /** * Display the list of Assigned works !!! */ $assignedWorks = DB::table('works as w')->leftJoin('department_works as dw', 'dw.id', '=', 'w.last_department_work_id')->leftJoin('user_works as uw', 'uw.id', '=', 'dw.last_user_work_id')->leftJoin('users as u', 'uw.assigned_to', '=', 'u.id')->leftJoin('users as us', 'w.created_by', '=', 'us.id')->leftJoin('departments as d', 'd.id', '=', 'dw.department_id'); if ($this->userWithDepartment->department[0]->pivot->is_senior == 1) { $assignedWorks = $assignedWorks->where(function ($query) { $query->where('dw.department_id', '=', $this->userWithDepartment->department[0]->id)->where('uw.accepted', '!=', -1)->where('uw.situation', '=', 0); }); } $assignedWorks = $assignedWorks->orWhere(function ($query) { $query->where('w.created_by', '=', $this->currentUser->getId())->where('dw.accepted', '!=', -1)->where('dw.situation', '=', 0); })->select(['w.id', 'w.deadline as deadline', 'w.slug', 'w.title', 'w.description', 'w.importance', DB::raw('CONCAT(us.first_name," ",us.last_name) as created_by'), 'd.name as department_name', DB::raw('CONCAT(u.first_name," ",u.last_name) as assigned_to'), 'uw.accepted as user_work_accepted', 'dw.accepted as department_work_accepted'])->orderBy('w.created_at', 'desc')->paginate(15, ['*'], 'assignedWorks'); $finishedWorks = DB::table('works as w')->leftJoin('department_works as dw', 'dw.id', '=', 'w.last_department_work_id')->leftJoin('user_works as uw', 'uw.id', '=', 'dw.last_user_work_id')->leftJoin('users as u', 'uw.assigned_to', '=', 'u.id')->leftJoin('users as us', 'w.created_by', '=', 'us.id')->leftJoin('departments as d', 'd.id', '=', 'dw.department_id')->where(function ($query) { $query->where('dw.department_id', '=', $this->userWithDepartment->department[0]->id)->where('uw.accepted', '=', 1)->where('uw.situation', '=', 1); })->orWhere(function ($query) { $query->where('w.created_by', '=', $this->currentUser->getId())->where('dw.accepted', '=', 1)->where('dw.situation', '=', 1); })->select(['w.id', 'w.deadline as deadline', 'w.slug', 'w.title', 'w.description', 'w.importance', DB::raw('CONCAT(us.first_name," ",us.last_name) as created_by'), 'd.name as department_name', DB::raw('CONCAT(u.first_name," ",u.last_name) as assigned_to'), 'uw.accepted as user_work_accepted', 'dw.accepted as department_work_accepted'])->orderBy('w.created_at', 'desc')->paginate(15, ['*'], 'finishedWorks'); $departments = Department::all(['id', 'name as text']); $departmentWorkers = DB::table('department_worker as dw')->join('users as u', 'u.id', '=', 'dw.user_id')->join('departments as d', 'd.id', '=', 'dw.department_id')->where('dw.department_id', '=', $this->userWithDepartment->department[0]->id)->get(['u.id as id', DB::raw('CONCAT(u.first_name," ",u.last_name) as text')]); $data = ['unAssignedWorks' => $unAssignedWorks, 'assignedWorks' => $assignedWorks, 'finishedWorks' => $finishedWorks, 'departments' => $departments, 'departmentWorkers' => json_encode($departmentWorkers), 'menu' => 'works', 'page_title' => 'İşler', 'page_description' => 'Şirket İşlerinin Listelendiği Sayfadır']; return view('admin.work.index', $data); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('delegations', function (Blueprint $table) { $table->increments('id'); $table->integer('delegate_to_id')->unsigned(); $table->integer('delegate_from_id')->unsigned(); $table->integer('department_id')->unsigned(); $table->boolean('user_set')->default(0); $table->timestamps(); }); Schema::table('delegations', function ($table) { $table->unique(array('department_id', 'delegate_from_id')); //A user can only vote once on a motion $table->foreign('delegate_to_id')->references('id')->on('users'); $table->foreign('delegate_from_id')->references('id')->on('users'); $table->foreign('department_id')->references('id')->on('departments'); }); $validUsers = User::notCouncillor()->get(); $departments = Department::all(); $numberOfCouncilors = User::councillor()->count(); if ($numberOfCouncilors) { foreach ($validUsers as $user) { foreach ($departments as $department) { $councillors = User::councillor()->get(); $leastDelegatedToCouncillor = $councillors->sortBy('totalDelegationsTo')->first(); $newDelegation = new Delegation(); $newDelegation->department_id = $department->id; $newDelegation->delegate_from_id = $user->id; $newDelegation->delegate_to_id = $leastDelegatedToCouncillor->id; $newDelegation->save(); } } } }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $departments = Department::all(); $subjects = Subject::all(); $department_subject = DepartmentSubject::find($id); return view('admin.department_subject.department_subject_edit', compact('departments', 'subjects', 'department_subject')); }
public function index(Request $request) { $query = $request->input(); $changes = Change::select('*'); if ($request->input('user')) { $changes = $changes->where('user_id', $request->input('user')); } if ($request->input('start')) { $changes = $changes->where('changes.created_at', '>=', $request->input('start')); } if ($request->input('end')) { $changes = $changes->where('changes.created_at', '<=', $request->input('end')); } if ($request->input('goat')) { $changes = $changes->where('goat_id', $request->input('goat')); } if ($request->input('type')) { $changes = $changes->where('change_type', $request->input('type')); } $changes = $changes->join('goats', 'goats.id', '=', 'changes.goat_id')->select('changes.description as description', 'changes.created_at as created_at', 'changes.change_type as change_type', 'changes.user_id as user_id', 'changes.goat_id as goat_id'); if ($request->input('dept')) { $changes = $changes->where('department_id', $request->input('dept')); } return view('changelog')->with(['changes' => $changes->orderBy('created_at', 'desc')->paginate(20), 'users' => \App\User::all(), 'depts' => \App\Department::all(), 'query' => $query]); }
/** * Show information update form. Please note * that a departmentStaff can only update * his name, email and password * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function showUpdateInfoForm() { // Get the logged in departmentStaff $departmentStaff = DepartmentStaff::find(Auth::guard('departmentStaff')->user()->id); // Get the list of departments present in databse $departments = Department::all(); return view($this->updateInfoView, ['departmentStaff' => $departmentStaff, 'departments' => $departments]); }
/** * Show the application registration form. * * @return \Illuminate\Http\Response */ public function showRegistrationForm() { // Get the list of departments $departmentArr = Department::all(); // Get the list of sections $sectionArr = Section::all(); return view($this->registerView)->with(['departments' => $departmentArr, 'sections' => $sectionArr]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if ($this->systemAdmin) { $departments = Department::all(); } else { $departments = Collection::make([Auth::user()->department]); } return view('admin.department.index', ['departments' => $departments, 'title' => trans('admin.departments'), 'url' => $this->systemAdmin ? action('Admin\\DepartmentController@create') : '']); }
/** * 부서를 가져옴 * * @return \Illuminate\Http\Response */ public function index() { $deptList = Department::all(); $retArr = []; foreach ($deptList as $dept) { $retArr[] = ['id' => "{$dept->id}", 'parent' => $dept->p_id == null ? '#' : "{$dept->p_id}", 'text' => $dept->dept_name]; } return Response()->json($retArr); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $estimates = Estimate::orderBy('id', 'DESC')->get(); $customers = Customer::all(); $vehicles = Vehicle::all(); $departments = Department::all(); $users = User::all(); return view('estimates.estimates', compact('estimates', 'customers', 'vehicles', 'departments', 'users')); }
/** * Execute the console command. * * @return mixed */ public function handle() { Delegation::where('user_set', 0)->delete(); $users = User::with('delegatedFrom')->validVoter()->get(); $departments = Department::all(); $councillors = User::councillor()->get(); foreach ($users as $user) { $user->createDefaultDelegations($departments, $councillors); } }
/** * Display a listing of the resource. * * @return Response */ public function index() { // if (Auth::user()->can('create-motions')) { //An admin able to see all users // $departments = Department::all(); // return $departments; // } //Other people can see a list of the public users $departments = Department::all(); return $departments; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { // If a guest redirect if ($this->auth->guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); } else { return redirect()->guest('login'); } } // TODO put somewhere else!!!!! // Get users departments and privilages $user = Auth::user()->with('departments')->where('user.id', Auth::id())->first(); $allowed_departments = []; $admin_departments = []; $super_user = $user->is_super_user; // If super user allow access to all departments if ($super_user) { $user_departments = Department::all(); // transfer collection to array foreach ($user_departments as $department) { $user->setAdmin(true); // TODO DISABLE $department->setAdmin(true); // Note user is admin of this department array_push($allowed_departments, $department); } } else { $user_departments = $user->Departments; // transfer collection to array foreach ($user_departments as $department) { // Check if the user is an admin in the department if ($user->isAdmin($department->id)) { $user->setAdmin(true); // User can access admin settings $department->setAdmin(true); // Note user is admin of this department } array_push($allowed_departments, $department); } } // Get an array of id's of all departments this user can access $match_departments = []; foreach ($allowed_departments as $department) { array_push($match_departments, $department->id); } // Save until next request Session::flash('user', $user); Session::flash('allowed_departments', $allowed_departments); Session::flash('match_departments', $match_departments); Session::flash('super_user', $super_user); // TODO CHNAGE TO MIDDLEWEAR ON LOCATION //dd($user); return $next($request); }
public function index(Request $request) { if ($request->get('department')) { $services = \App\Service::filterByDepartment($request->get('department'))->get(); $departments = \App\Department::where('id', $request->get('department'))->get(); } elseif ($request->get('domain')) { $domain = \App\Domain::findOrfail($request->get('domain')); $services = $domain->services()->get(); $departments = $domain->departments()->get(); } else { $services = $this->services; $departments = \App\Department::all(); } return view('services.index', ['services' => $services, 'departments' => $departments]); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $pageTitle = 'Add New Department'; // Initiate $existedDepartments = array(); // All departments are available if user is administrator but only departments that assigned below if user is department manager. if (Auth::user()->hasRole(['administrator'])) { $existedDepartments = Department::all(); } if (Auth::user()->hasRole(['department_manager'])) { $managedDepartment = DB::table('departments')->where('manager', Auth::user()->id)->first(); array_push($existedDepartments, $managedDepartment); $subDepartments = DB::table('departments')->where('parent_department', $managedDepartment->id)->get(); foreach ($subDepartments as $department) { array_push($existedDepartments, $department); } } return view('home.departments.create', compact('pageTitle', 'existedDepartments')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $pageTitle = 'Add New Category'; // If user is administrator if (Auth::user()->hasRole(['administrator'])) { $departments = Department::all()->toArray(); } // If user is department manager if (Auth::user()->hasRole(['department_manager'])) { $managedDepartment = Auth::user()->departments->first(); $allDepartments = Department::all(); foreach ($allDepartments as $oneDepartment) { if (isManageableDepartment($managedDepartment->id, $oneDepartment->id)) { array_push($departments, $oneDepartment->toArray()); } } } // If user is category manager if (Auth::user()->hasRole(['category_manager'])) { $departments = Auth::user()->departments->toArray(); } return view('home.categories.create', compact('pageTitle', 'departments')); }
public function index() { $ticket_types = TicketType::all(); $departments = Department::all(); $business_hours = BusinessHour::all(); $service_times = ServiceTime::all(); $languages = Helper::getAllLanguages(); $config = Helper::getConfiguration(); $mail_config = Helper::getMail(); $services = Helper::getServices(); $next_ticket_no = \App\Ticket::max('ticket_no'); $next_ticket_no = isset($next_ticket_no) ? $next_ticket_no + 1 : 1; $assets = ['datetimepicker', 'mail_config']; $week_days = config('list.week'); $time_unit = config('list.time_unit'); $priority = config('list.priority'); $time_type = config('list.time_type'); $roles = DB::table('roles')->get(); $permissions = DB::table('permissions')->orderBy('category')->get(); $permission_role = DB::table('permission_role')->select(DB::raw('CONCAT(role_id,"-",permission_id) AS detail,id'))->lists('detail', 'id'); $data = ['languages' => $languages, 'config' => $config, 'mail_config' => $mail_config, 'services' => $services, 'roles' => $roles, 'permissions' => $permissions, 'permission_role' => $permission_role, 'assets' => $assets, 'ticket_types' => $ticket_types, 'departments' => $departments, 'week_days' => $week_days, 'business_hours' => $business_hours, 'service_times' => $service_times, 'time_unit' => $time_unit, 'priority' => $priority, 'time_type' => $time_type, 'next_ticket_no' => $next_ticket_no, 'category' => null]; return view('configuration.index', $data); }
public function createDefaultDelegations($departments = null, $councillors = null) { if (!$this->can('create-votes')) { return true; } if (!$departments) { $departments = Department::all(); } if (!$councillors) { $councillors = User::councillor()->get(); } if ($councillors->isEmpty()) { return true; // "there are no councillors"; } if ($this->hasRole('councillor')) { return true; //A councillor cannot delegate } // Code to potentially do this more efficiently with fewer database calls // $userDelegations = $user->delegatedFrom; // $filteredDepartments = $departments->filter(function($item){ // return $item->id; + is not in a flattened array of this users delegations // }); // $insertsArray = []; //foreach($filteredDepartments as $filteredDepartment){ // Add to the inserts array, at the end do one huge insert //} // $this->insert(Insert all these array items) foreach ($departments as $department) { $leastDelegatedToCouncillor = $councillors->sortBy('totalDelegationsTo')->first(); $newDelegation = new Delegation(); $newDelegation->department_id = $department->id; $newDelegation->delegate_from_id = $this->id; $newDelegation->delegate_to_id = $leastDelegatedToCouncillor->id; $newDelegation->save(); } }
public function edit(User $staff) { if (\Auth::user()->role_id == 1) { return view('html.error-403'); } $title = "Edit " . $staff->name; $role = Role::where('id', '<>', '4')->get(); $department = Department::all(); return view('html.staff.add-edit', compact('staff', 'title', 'role', 'department')); }
/** * Bootstrap any application services. * * @return void */ public function boot() { if (\Schema::hasTable('positions')) { $positions = Position::all(); $selectPositions = array(); $selectPositions[0] = "Select / All"; foreach ($positions as $position) { $selectPositions[$position->slug] = $position->name; } \View::share('selectPositions', $selectPositions); } if (\Schema::hasTable('cases_priorities')) { $priorities = CasePriority::all(); $selectPriorities = array(); $selectPriorities[0] = "Select / All"; foreach ($priorities as $priority) { $selectPriorities[$priority->slug] = $priority->name; } \View::share('selectPriorities', $selectPriorities); } if (\Schema::hasTable('titles')) { $titles = Title::all(); $selectTitles = array(); $selectTitles[0] = "Select / All"; foreach ($titles as $title) { $selectTitles[$title->slug] = $title->name; } \View::share('selectTitles', $selectTitles); } if (\Schema::hasTable('languages')) { $languages = Language::all(); $selectLanguages = array(); $selectLanguages[0] = "Select / All"; foreach ($languages as $language) { $selectLanguages[$language->slug] = $language->name; } \View::share('selectLanguages', $selectLanguages); } if (\Schema::hasTable('departments')) { $departments = Department::all(); $selectDepartments = array(); $selectDepartments[0] = "Select / All"; foreach ($departments as $department) { $selectDepartments[$department->slug] = $department->name; } \View::share('selectDepartments', $selectDepartments); } if (\Schema::hasTable('users_roles')) { $roles = UserRole::all(); $selectRoles = array(); $selectRoles[0] = "Select / All"; foreach ($roles as $role) { $selectRoles[$role->slug] = $role->name; } \View::share('selectRoles', $selectRoles); } if (\Schema::hasTable('provinces')) { $provinces = Province::all(); $selectProvinces = array(); $selectProvinces[0] = "Select / All"; foreach ($provinces as $Province) { $selectProvinces[$Province->slug] = $Province->name; } \View::share('selectProvinces', $selectProvinces); } if (\Schema::hasTable('districts')) { $districts = District::all(); $selectDistrict = array(); $selectDistricts[0] = "Select / All"; foreach ($districts as $district) { $selectDistricts[$district->slug] = $district->name; } \View::share('selectDistricts', $selectDistricts); } if (\Schema::hasTable('municipalities')) { $municipalities = Municipality::all(); $selectMunicipalities = array(); $selectMunicipalities[0] = "Select / All"; foreach ($municipalities as $municipality) { $selectMunicipalities[$municipality->slug] = $municipality->name; } \View::share('selectMunicipalities', $selectMunicipalities); } if (\Schema::hasTable('wards')) { $wards = Ward::all(); $selectWards = array(); $selectWards[0] = "Select / All"; foreach ($wards as $ward) { $selectWards[$ward->slug] = $ward->name; } \View::share('selectWards', $selectWards); } if (\Schema::hasTable('categories')) { $categories = Category::all(); $selectCategories = array(); $selectCategories[0] = "Select / All"; foreach ($categories as $category) { $selectCategories[$category->slug] = $category->name; } \View::share('selectCategories', $selectCategories); } if (\Schema::hasTable('sub_categories')) { $subCategories = SubCategory::all(); $selectSubCategories = array(); $selectSubCategories[0] = "Select / All"; foreach ($subCategories as $subCategory) { $selectSubCategories[$subCategory->slug] = $subCategory->name; } \View::share('selectSubCategories', $selectSubCategories); } if (\Schema::hasTable('sub_sub_categories')) { $subSubCategories = SubSubCategory::all(); $selectSubSubCategories = array(); $selectSubSubCategories[0] = "Select / All"; foreach ($subSubCategories as $subSubCategory) { $selectSubSubCategories[$subSubCategory->slug] = $subSubCategory->name; } \View::share('selectSubSubCategories', $selectSubSubCategories); } if (\Schema::hasTable('relationships')) { $relationships = Relationship::all(); $selectRelationships = array(); $selectRelationships[0] = "Select / All"; foreach ($relationships as $relationship) { $selectRelationships[$relationship->id] = $relationship->name; } \View::share('selectRelationships', $selectRelationships); } if (\Schema::hasTable('cases')) { $cases = \DB::table('cases')->join('users', 'cases.reporter', '=', 'users.id')->select(\DB::raw("\n IF(`cases`.`addressbook` = 1,(SELECT CONCAT(`first_name`, ' ', `surname`) FROM `addressbook` WHERE `addressbook`.`id`= `cases`.`reporter`), (SELECT CONCAT(users.`name`, ' ', users.`surname`) FROM `users` WHERE `users`.`id`= `cases`.`reporter`)) as reporterName\n\n "))->get(); $reporters = array(); $reporters[0] = "Select / All"; foreach ($cases as $case) { $reporters[$case->reporterName] = $case->reporterName; } \View::share('selectReporters', $reporters); } View()->composer('master', function ($view) { $view->with('addressBookNumber', addressbook::all()); if (\Auth::check()) { $number = addressbook::where('user', '=', \Auth::user()->id)->get(); $view->with('addressBookNumber', $number); $allUsers = User::where('id', '<>', \Auth::user()->id)->get(); $view->with('loggedInUsers', $allUsers); $noPrivateMessages = Message::where('to', '=', \Auth::user()->id)->where('read', '=', 0)->where('message_type', '=', 0)->get(); $view->with('noPrivateMessages', $noPrivateMessages); $noInboxMessages = Message::where('to', '=', \Auth::user()->id)->where('message_type', '=', 0)->get(); $view->with('noInboxMessages', $noInboxMessages); $noDepartments = Department::all(); $view->with('noDepartments', $noDepartments); $noUsers = User::all(); $view->with('noUsers', $noUsers); $noRoles = UserRole::all(); $view->with('noRoles', $noRoles); $noPositions = Position::all(); $view->with('noPositions', $noPositions); $noRelationships = Relationship::all(); $view->with('noRelationships', $noRelationships); $noProvinces = Province::all(); $view->with('noProvinces', $noProvinces); $noCaseStatuses = CaseStatus::all(); $view->with('noCaseStatuses', $noCaseStatuses); $userRole = UserRole::where('id', '=', \Auth::user()->role)->first(); $view->with('systemRole', $userRole); $noCasesPriorities = CasePriority::all(); $view->with('noCasesPriorities', $noCasesPriorities); } }); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { return view('admin.user_edit', ['user' => User::findOrFail($id), 'depts' => Department::all()]); }
public function getCreateNewManager() { $department = Department::all(); $title = "Create A New Manager"; return view('html.team.admin.create-new-manager', compact('title', 'department')); }
public function index() { $departments = Department::all(); return view('admin.department.index', compact('departments')); }
$start_year = Carbon::createFromFormat("Y-m-d", $plan_option->startdate)->format("Y"); $end_year = Carbon::createFromFormat("Y-m-d", $plan_option->enddate)->format("Y"); ?> <li><a href="/plan/{{ $plan_option->id }}">Plan {{ $start_year }} - {{ $end_year }}</a></li> @if(count(Plan::all()) > $plan_option->id ) <li role="separator" class="divider"></li> @endif @endforeach </ul> </div> @endif <?php $filter_options = ["Actions", "Tasks"]; $dept_options = Department::all(); $team_options = Team::all(); ?> @foreach($filter_options as $option) <a type="button" class="btn btn-primary" href="/sort/{{ $plan->id }}/{{ strtolower(preg_replace('/[^a-z0-9]+/i', '', $option)) }}">{{ $option }}</a> @endforeach <div class="dropdown btn-group"> <button class="btn btn-primary dropdown-toggle" type="button" id="teamDeptDropdown" data-toggle="dropdown"> Team/Department <span class="caret"></span> </button> <ul class="dropdown-menu"> <li class="dropdown-header">Departments</li>
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function listDep() { $dep = Department::all(); return view('admin.department.list', compact('dep')); }
<th>Created At</th> <th>Action</th> <th>Assign To</th> </tr> </thead> <tbody> @foreach($tickets as $ticket) <tr> <td>{{ $ticket->id }}</td> <td>{{ substr($ticket->desc,0,50) . '...' }}</td> <td>{{ $ticket->name }}</td> <td>{{ $ticket->email }}</td> <td> <?php $departmentCategories = \App\Department::all(); ?> <form action="/tickets/{{ $ticket->id }}" method="POST"> <input type="hidden" name="_token" value="{{ csrf_token() }}"> <input name="_method" type="hidden" value="PUT"> <select class="form-control" style="height: 25px" name="department_id" onchange="this.form.submit()"> @foreach($departmentCategories as $departmentCategory) @if($departmentCategory->id == $ticket->department->id) <option selected="selected" value="{{ $departmentCategory->id }}"> {{ $departmentCategory->department }}</option> @else <option value="{{ $departmentCategory->id }}"> {{ $departmentCategory->department }} </option> @endif
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $roles = Roles::find($id); $department = \App\Department::all(); return view('roles.edit')->with('department', $department)->with('roles', $roles); }
/** * Store a newly created department in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(SaveDepartmentRequest $request) { Department::create(['code' => $request->code, 'name' => $request->name]); $departments = Department::all(); return view('layouts.viewDepartments', ['departments' => $departments]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $dept = Department::all(); return View::make('department.all', ['departments' => $dept, 'selectedCity' => 0, 'category' => 1]); }
/** * @return \Illuminate\View\View */ public function index() { $departments = \App\Department::all(); return view('publicTicket', compact('departments')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $users = \App\User::all(); $departments = \App\Department::all(); return view('tickets.create', compact('users', 'departments')); }