Commit bfc309077c1146a50552d6efdfa535184a41d2b2

Authored by Андрей Ларионов
1 parent 0daf30f527
Exists in master

Вакансии

Showing 1 changed file with 1 additions and 1 deletions Inline Diff

app/Http/Controllers/Admin/JobTitlesController.php
1 <?php 1 <?php
2 2
3 namespace App\Http\Controllers\Admin; 3 namespace App\Http\Controllers\Admin;
4 4
5 use App\Http\Controllers\Controller; 5 use App\Http\Controllers\Controller;
6 use App\Http\Requests\JobTitlesRequest; 6 use App\Http\Requests\JobTitlesRequest;
7 use App\Models\Category; 7 use App\Models\Category;
8 use App\Models\Job_title; 8 use App\Models\Job_title;
9 use App\Models\Positions; 9 use App\Models\Positions;
10 use Illuminate\Http\Request; 10 use Illuminate\Http\Request;
11 11
12 class JobTitlesController extends Controller 12 class JobTitlesController extends Controller
13 { 13 {
14 /** 14 /**
15 * Display a listing of the resource. 15 * Display a listing of the resource.
16 * 16 *
17 * @return \Illuminate\Http\Response 17 * @return \Illuminate\Http\Response
18 */ 18 */
19 public function index() 19 public function index()
20 { 20 {
21 $Jobs = Job_title::query()->orderBy('name')->paginate(15); 21 $Jobs = Job_title::query()->where('is_remove', '=', '0')->orderBy('name')->paginate(15);
22 return view('admin.job_titles.index', compact('Jobs')); 22 return view('admin.job_titles.index', compact('Jobs'));
23 } 23 }
24 24
25 /** 25 /**
26 * Show the form for creating a new resource. 26 * Show the form for creating a new resource.
27 * 27 *
28 * @return \Illuminate\Http\Response 28 * @return \Illuminate\Http\Response
29 */ 29 */
30 public function create() 30 public function create()
31 { 31 {
32 /*$items = Job_title::query()-> 32 /*$items = Job_title::query()->
33 orderByDesc('sort')-> 33 orderByDesc('sort')->
34 orderBy('name')-> 34 orderBy('name')->
35 active()-> 35 active()->
36 get();*/ 36 get();*/
37 $category = Category::query()->active()->get(); 37 $category = Category::query()->active()->get();
38 38
39 return view('admin.job_titles.add', compact('category')); 39 return view('admin.job_titles.add', compact('category'));
40 } 40 }
41 41
42 /** 42 /**
43 * Store a newly created resource in storage. 43 * Store a newly created resource in storage.
44 * 44 *
45 * @param \Illuminate\Http\Request $request 45 * @param \Illuminate\Http\Request $request
46 * @return \Illuminate\Http\Response 46 * @return \Illuminate\Http\Response
47 */ 47 */
48 public function store(JobTitlesRequest $request) 48 public function store(JobTitlesRequest $request)
49 { 49 {
50 Job_title::create($request->all()); 50 Job_title::create($request->all());
51 return redirect()->route('admin.job-titles.index'); 51 return redirect()->route('admin.job-titles.index');
52 } 52 }
53 53
54 /** 54 /**
55 * Display the specified resource. 55 * Display the specified resource.
56 * 56 *
57 * @param \App\Models\Job_title $job_title 57 * @param \App\Models\Job_title $job_title
58 * @return \Illuminate\Http\Response 58 * @return \Illuminate\Http\Response
59 */ 59 */
60 public function show(Job_title $job_title) 60 public function show(Job_title $job_title)
61 { 61 {
62 // 62 //
63 } 63 }
64 64
65 /** 65 /**
66 * Show the form for editing the specified resource. 66 * Show the form for editing the specified resource.
67 * 67 *
68 * @param \App\Models\Job_title $job_title 68 * @param \App\Models\Job_title $job_title
69 * @return \Illuminate\Http\Response 69 * @return \Illuminate\Http\Response
70 */ 70 */
71 public function edit(Job_title $job_title) 71 public function edit(Job_title $job_title)
72 { 72 {
73 $category = Category::query()->active()->get(); 73 $category = Category::query()->active()->get();
74 return view('admin.job_titles.edit', compact('job_title', 'category')); 74 return view('admin.job_titles.edit', compact('job_title', 'category'));
75 } 75 }
76 76
77 /** 77 /**
78 * Update the specified resource in storage. 78 * Update the specified resource in storage.
79 * 79 *
80 * @param \Illuminate\Http\Request $request 80 * @param \Illuminate\Http\Request $request
81 * @param \App\Models\Job_title $job_title 81 * @param \App\Models\Job_title $job_title
82 * @return \Illuminate\Http\Response 82 * @return \Illuminate\Http\Response
83 */ 83 */
84 public function update(JobTitlesRequest $request, Job_title $job_title) 84 public function update(JobTitlesRequest $request, Job_title $job_title)
85 { 85 {
86 $job_title->update($request->all()); 86 $job_title->update($request->all());
87 return redirect()->route('admin.job-titles.index'); 87 return redirect()->route('admin.job-titles.index');
88 } 88 }
89 89
90 /** 90 /**
91 * Remove the specified resource from storage. 91 * Remove the specified resource from storage.
92 * 92 *
93 * @param \App\Models\Job_title $job_title 93 * @param \App\Models\Job_title $job_title
94 * @return \Illuminate\Http\Response 94 * @return \Illuminate\Http\Response
95 */ 95 */
96 public function destroy(Job_title $job_title) 96 public function destroy(Job_title $job_title)
97 { 97 {
98 $job_title->update(['is_remove' => 1]); 98 $job_title->update(['is_remove' => 1]);
99 return redirect()->route('admin.job-titles.index'); 99 return redirect()->route('admin.job-titles.index');
100 } 100 }
101 } 101 }
102 102