|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Telefonica\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use Siravel\Models\Blog\Article; |
|
6
|
|
|
use Siravel\Models\Blog\Category; |
|
7
|
|
|
use Telefonica\Models\Digital\Phone; |
|
8
|
|
|
use Stalker\Models\Photo; |
|
9
|
|
|
use Stalker\Models\PhotoAlbum; |
|
10
|
|
|
|
|
11
|
|
|
class PhoneController extends Controller { |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
public function index() |
|
15
|
|
|
{ |
|
16
|
|
|
|
|
17
|
|
|
$phones = Phone::all(); |
|
18
|
|
|
return view('root.phones.index', compact('phones')); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Show the form for creating a new resource. |
|
23
|
|
|
* |
|
24
|
|
|
* @return \Illuminate\Http\Response |
|
25
|
|
|
*/ |
|
26
|
|
|
public function create() |
|
27
|
|
|
{ |
|
28
|
|
|
return view('root.phones.create'); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Store a newly created resource in storage. |
|
33
|
|
|
* |
|
34
|
|
|
* @param \Illuminate\Http\Request $request |
|
35
|
|
|
* |
|
36
|
|
|
* @return \Illuminate\Http\Response |
|
37
|
|
|
*/ |
|
38
|
|
|
public function store(Request $request) |
|
39
|
|
|
{ |
|
40
|
|
|
Phone::create(['name' => $request->name]); |
|
41
|
|
|
|
|
42
|
|
|
return redirect('phones'); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Show the form for editing the specified resource. |
|
47
|
|
|
* |
|
48
|
|
|
* @param int $id |
|
49
|
|
|
* |
|
50
|
|
|
* @return \Illuminate\Http\Response |
|
51
|
|
|
*/ |
|
52
|
|
|
public function edit($id) |
|
53
|
|
|
{ |
|
54
|
|
|
$phone = Phone::findOrFail($id); |
|
55
|
|
|
|
|
56
|
|
|
return view('root.phones.edit', compact('phone')); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Update the specified resource in storage. |
|
61
|
|
|
* |
|
62
|
|
|
* @param \Illuminate\Http\Request $request |
|
63
|
|
|
* |
|
64
|
|
|
* @return \Illuminate\Http\Response |
|
65
|
|
|
*/ |
|
66
|
|
|
public function update(Request $request) |
|
67
|
|
|
{ |
|
68
|
|
|
$phone = Phone::findOrFail($request->phone_id); |
|
69
|
|
|
|
|
70
|
|
|
$phone->name = $request->name; |
|
71
|
|
|
|
|
72
|
|
|
$phone->update(); |
|
73
|
|
|
|
|
74
|
|
|
return redirect('phones'); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Remove the specified resource from storage. |
|
79
|
|
|
* |
|
80
|
|
|
* @param int $id |
|
81
|
|
|
* |
|
82
|
|
|
* @return \Illuminate\Http\Response |
|
83
|
|
|
*/ |
|
84
|
|
|
public function destroy($id) |
|
85
|
|
|
{ |
|
86
|
|
|
$phone = Phone::findOrFail($id); |
|
87
|
|
|
|
|
88
|
|
|
$phone->delete(); |
|
89
|
|
|
|
|
90
|
|
|
return redirect('phones'); |
|
91
|
|
|
} |
|
92
|
|
|
} |