本文整理汇总了PHP中app\Department类的典型用法代码示例。如果您正苦于以下问题:PHP Department类的具体用法?PHP Department怎么用?PHP Department使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Department类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy(Department $department)
{
if (!Helper::getMode()) {
return redirect()->back()->withErrors(config('constants.DISABLE_MESSAGE'));
}
$department->delete();
return redirect('/configuration#department')->withSuccess(config('constants.DELETED'));
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('departments')->delete();
$department = new Department(['deptHeadId' => '1001', 'department' => 'Neurology']);
$department->save();
$department = new Department(['deptHeadId' => '1002', 'department' => 'Emergency Room']);
$department->save();
$department = new Department(['deptHeadId' => '1003', 'department' => 'ICU']);
$department->save();
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$departments = ['Unknown', 'City Administrator', 'Community Services', 'Corporate Services', 'Communications and Economic Development', 'Planning and Development', 'Public Safety', 'Public Works and Engineering'];
foreach ($departments as $name) {
$department = new Department();
$department->active = true;
$department->name = $name;
$department->save();
}
}
示例4: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create($filing_type = '')
{
//Initialization
$projects = new Project();
$EASRequest = new EASRequest();
$RequestType = new RequestType();
$RequestTypeApprover = new RequestTypeApprover();
$User = new User();
$Department = new Department();
$data['filing_type'] = $filing_type;
$user_id = trim(Auth::user()->app_code);
//Retrieve user granted projects
if ($filing_type == 'PR') {
$data['data_charge_to_projects'] = $projects->getProjects('', $filing_type, '3');
} else {
$data['projects'] = $projects->getProjects($user_id, $filing_type, '3');
}
//Additional variables per request type, if any.
if ($filing_type == 'RFR') {
$data['granted_request_types'] = $RequestTypeApprover->getUserGrantedRequestTypes($user_id, 'RFR');
} else {
if ($filing_type == 'PR') {
$data['data_pr_request_types'] = $RequestType->getRequestType($filing_type, 'all');
$data['data_charge_to_teams'] = $Department->getDepartments();
$data['requesting_department'] = $User->getDepartment($user_id);
$data['pr_no'] = $data['requesting_department']['dept_initial'] . '-' . date('mmddY') . '-';
$data['team_members'] = $User->getCoTeamMembers($user_id);
}
}
//Return View
if ($filing_type == 'PR') {
return view('request.purchase.file', $data);
}
return view('request.file', $data);
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$data = $request->except('_token');
Department::create($data);
return back();
}
示例6: up
/**
* 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();
}
}
}
}
示例7: run
public function run()
{
$depts = Department::filterByDomain(1)->lists('name', 'id')->toArray();
$prompt = [0 => 'Department'];
$departments = $prompt + $depts;
return view("widgets.select_department", ['departments' => $departments]);
}
示例8: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// Create level 0 : member
Level::create(['level' => 0, 'name' => 'membre']);
// Create level 1 : band_creator
Level::create(['level' => 1, 'name' => 'manager']);
// Create level 2 : teacher
Level::create(['level' => 2, 'name' => 'professeur']);
// Create level 3 : admin
Level::create(['level' => 3, 'name' => 'admin']);
// Create level 10 : webmaster
Level::create(['level' => 10, 'name' => 'webmaster']);
// Create departement : "aucun"
Department::create(['name' => 'Aucun', 'short_name' => 'Aucun']);
// Create user : Webmaster (lvl 10)
User::create(['first_name' => 'Webmaster', 'last_name' => 'Webmaster', 'email' => 'webm@ster', 'school_year' => 0, 'department_id' => 1, 'password' => bcrypt('webmastercmt'), 'level_id' => 5, 'slug' => 'webmaster-webmaster-1']);
Category::create(['name' => 'Aucune']);
Category::create(['name' => 'Autre']);
Category::create(['name' => 'Présentation']);
Category::create(['name' => 'Création de groupe']);
Category::create(['name' => 'Recherche de groupe']);
Category::create(['name' => 'Échange/Vente']);
//Creation basic instruments :
$instruments = ['autre', 'guitare', 'piano', 'basse', 'chant', 'flûte', 'violon', 'contrebasse', 'clarinette', 'saxophone', 'batterie', 'violoncelle', 'guitare électrique', 'flûte traversière', 'trompette', 'cor', 'trombone', 'tuba'];
$this->create_instrument($instruments);
}
示例9: index
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]);
}
示例10: doChooseEmployee
/**
* User chose single employee from dropdown to be edited
*
* @param Request $request
* @return mixed
*/
public function doChooseEmployee(Request $request)
{
$employee = Employee::find($request->input('choose'));
$dept = ['' => 'Choose...'] + Department::lists('name', 'id')->all();
$location = ['' => 'Choose...'] + Location::lists('name', 'id')->all();
return view('admin.edit-employee', compact('dept', 'location', 'employee'));
}
示例11: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
foreach (range(1, 10) as $index) {
Department::create(['title' => $faker->company]);
}
}
示例12: departmentView
public function departmentView($department_code, $filter)
{
$ticketFilter = new TicketFilter($department_code, $filter);
$tickets = $ticketFilter->departmentViewFilter();
$department = \App\Department::where('department_code', $department_code)->first();
return view('helpdeskviews.department', compact('department', 'tickets', 'filter'));
}
示例13: search
public function search(Request $request)
{
$results = array();
$term = $request->get('term');
$goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
$departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
$users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
if (in_array($matching_user_email, $users)) {
continue;
}
$users[] = $matching_user_email;
}
$notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
$types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
foreach ($types as $type) {
foreach ($type as $result) {
$results[] = $result;
}
}
return view('search.show')->with('results', $results)->with('term', $term);
}
示例14: update
public function update(Request $request)
{
$department = Department::find($request->department_id);
$department->name = $request->name;
$department->save();
return Redirect::to('/admin/department');
}
示例15: importDept
public function importDept($destfile)
{
$this->count['dept->success'] = 0;
$this->count['dept->failed'] = 0;
Excel::load($destfile, function ($reader) {
$rules = ['name' => 'required|unique_with:departments,company_id,costcent', 'company_id' => 'required|exists:companies,id', 'costcent' => 'required'];
$sheetsCount = $reader->getSheetCount();
for ($i = 0; $i < $sheetsCount; $i++) {
$sheets = $reader->getSheet($i)->toArray();
$company_name = $reader->getSheet($i)->getTitle();
$dept['company_id'] = Company::where('name', $company_name)->value('id');
$sheetCount = count($sheets);
for ($j = 6; $j < $sheetCount; $j++) {
$dept['name'] = trim($sheets[$j][1]);
$dept['costcent'] = trim($sheets[$j][10]);
$dept['description'] = $dept['name'];
$dept_v = \Validator::make($dept, $rules);
if ($dept_v->passes()) {
Department::create($dept);
$this->count['dept->success'] += 1;
} else {
$this->count['dept->failed'] += 1;
}
}
}
//END
});
return $this->count;
}