|
1
|
|
|
<?php
|
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers;
|
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Http\Request;
|
|
6
|
|
|
|
|
7
|
|
|
use App\Http\Requests;
|
|
8
|
|
|
use App\Creator;
|
|
9
|
|
|
use Illuminate\Support\Facades\Session;
|
|
10
|
|
|
|
|
11
|
|
|
class AdminCreatorController extends Controller
|
|
12
|
|
|
{
|
|
13
|
|
|
/**
|
|
14
|
|
|
* Display a listing of the resource.
|
|
15
|
|
|
*
|
|
16
|
|
|
* @return \Illuminate\Http\Response
|
|
17
|
|
|
*/
|
|
18
|
|
|
public function index()
|
|
19
|
|
|
{
|
|
20
|
|
|
$creators = Creator::all();
|
|
21
|
|
|
return view('Admin.creators.index',compact('creators'));
|
|
22
|
|
|
}
|
|
23
|
|
|
|
|
24
|
|
|
/**
|
|
25
|
|
|
* Show the form for creating a new resource.
|
|
26
|
|
|
*
|
|
27
|
|
|
* @return \Illuminate\Http\Response
|
|
28
|
|
|
*/
|
|
29
|
|
|
public function create()
|
|
30
|
|
|
{
|
|
31
|
|
|
//
|
|
32
|
|
|
}
|
|
33
|
|
|
|
|
34
|
|
|
/**
|
|
35
|
|
|
* Store a newly created resource in storage.
|
|
36
|
|
|
*
|
|
37
|
|
|
* @param \Illuminate\Http\Request $request
|
|
38
|
|
|
* @return \Illuminate\Http\Response
|
|
39
|
|
|
*/
|
|
40
|
|
|
public function store(Request $request)
|
|
|
|
|
|
|
41
|
|
|
{
|
|
42
|
|
|
//
|
|
43
|
|
|
}
|
|
44
|
|
|
|
|
45
|
|
|
/**
|
|
46
|
|
|
* Display the specified resource.
|
|
47
|
|
|
*
|
|
48
|
|
|
* @param int $id
|
|
49
|
|
|
* @return \Illuminate\Http\Response
|
|
50
|
|
|
*/
|
|
51
|
|
|
public function show($id)
|
|
|
|
|
|
|
52
|
|
|
{
|
|
53
|
|
|
//
|
|
54
|
|
|
}
|
|
55
|
|
|
|
|
56
|
|
|
/**
|
|
57
|
|
|
* Show the form for editing the specified resource.
|
|
58
|
|
|
*
|
|
59
|
|
|
* @param int $id
|
|
60
|
|
|
* @return \Illuminate\Http\Response
|
|
61
|
|
|
*/
|
|
62
|
|
|
public function edit($id)
|
|
63
|
|
|
{
|
|
64
|
|
|
$creator = Creator::find($id);
|
|
65
|
|
|
$creators = Creator::all();
|
|
66
|
|
|
return view('Admin.creators.edit',compact('creator','creators'));
|
|
67
|
|
|
}
|
|
68
|
|
|
|
|
69
|
|
|
/**
|
|
70
|
|
|
* Update the specified resource in storage.
|
|
71
|
|
|
*
|
|
72
|
|
|
* @param \Illuminate\Http\Request $request
|
|
73
|
|
|
* @param int $id
|
|
74
|
|
|
* @return \Illuminate\Http\Response
|
|
75
|
|
|
*/
|
|
76
|
|
|
public function update(Request $request, $id)
|
|
77
|
|
|
{
|
|
78
|
|
|
Creator::updateOrCreate(['id'=>$id],[
|
|
|
|
|
|
|
79
|
|
|
'postcode' => $request['postcode'],
|
|
80
|
|
|
'country' => $request['country'],
|
|
81
|
|
|
'home_address' => $request['home_address'],
|
|
82
|
|
|
]);
|
|
83
|
|
|
Session::flash('message','Successfully updated');
|
|
84
|
|
|
return redirect(url('creators'));
|
|
|
|
|
|
|
85
|
|
|
}
|
|
86
|
|
|
|
|
87
|
|
|
/**
|
|
88
|
|
|
* Remove the specified resource from storage.
|
|
89
|
|
|
*
|
|
90
|
|
|
* @param int $id
|
|
91
|
|
|
* @return \Illuminate\Http\Response
|
|
92
|
|
|
*/
|
|
93
|
|
|
public function destroy($id)
|
|
94
|
|
|
{
|
|
95
|
|
|
Creator::destroy($id);
|
|
96
|
|
|
|
|
97
|
|
|
Session::flash('message','Successfully deleted');
|
|
98
|
|
|
return redirect(url('creators'));
|
|
|
|
|
|
|
99
|
|
|
}
|
|
100
|
|
|
}
|
|
101
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.