|
1
|
|
|
<?php
|
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers;
|
|
4
|
|
|
|
|
5
|
|
|
use App\Backer;
|
|
6
|
|
|
use Illuminate\Http\Request;
|
|
7
|
|
|
|
|
8
|
|
|
use App\Http\Requests;
|
|
9
|
|
|
use Illuminate\Support\Facades\Session;
|
|
10
|
|
|
|
|
11
|
|
|
class BackerController extends Controller
|
|
12
|
|
|
{
|
|
13
|
|
|
/**
|
|
14
|
|
|
* Display a listing of the resource.
|
|
15
|
|
|
*
|
|
16
|
|
|
* @return \Illuminate\Http\Response
|
|
17
|
|
|
*/
|
|
18
|
|
|
public function index()
|
|
19
|
|
|
{
|
|
20
|
|
|
$backers = Backer::all();
|
|
21
|
|
|
return view('Admin.backer.index',compact('backers'));
|
|
22
|
|
|
}
|
|
23
|
|
|
|
|
24
|
|
|
/**
|
|
25
|
|
|
* Show the form for editing the specified resource.
|
|
26
|
|
|
*
|
|
27
|
|
|
* @param int $id
|
|
28
|
|
|
* @return \Illuminate\Http\Response
|
|
29
|
|
|
*/
|
|
30
|
|
|
public function edit($id)
|
|
31
|
|
|
{
|
|
32
|
|
|
$backers = Backer::all();
|
|
33
|
|
|
$backer = Backer::find($id);
|
|
34
|
|
|
return view('Admin.backer.edit',compact('backers','backer'));
|
|
35
|
|
|
}
|
|
36
|
|
|
|
|
37
|
|
|
/**
|
|
38
|
|
|
* Update the specified resource in storage.
|
|
39
|
|
|
*
|
|
40
|
|
|
* @param \Illuminate\Http\Request $request
|
|
41
|
|
|
* @param int $id
|
|
42
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
43
|
|
|
*/
|
|
44
|
|
|
public function update(Request $request, $id)
|
|
45
|
|
|
{
|
|
46
|
|
|
$backer = Backer::find($id);
|
|
47
|
|
|
$backer->update([
|
|
48
|
|
|
'reward' => $request['reward'],
|
|
49
|
|
|
'method_of_pay' => $request['method_of_pay'],
|
|
50
|
|
|
'amount' => $request['amount'],
|
|
51
|
|
|
'funds' => $request['funds']
|
|
52
|
|
|
]);
|
|
53
|
|
|
$backer->save();
|
|
54
|
|
|
Session::flash('message','Successfully updated');
|
|
55
|
|
|
return redirect(route('backer'));
|
|
56
|
|
|
}
|
|
57
|
|
|
|
|
58
|
|
|
/**
|
|
59
|
|
|
* Remove the specified resource from storage.
|
|
60
|
|
|
*
|
|
61
|
|
|
* @param int $id
|
|
62
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
63
|
|
|
*/
|
|
64
|
|
|
public function destroy($id)
|
|
65
|
|
|
{
|
|
66
|
|
|
$backer = Backer::find($id);
|
|
67
|
|
|
$backer->delete();
|
|
68
|
|
|
Session::flash('message','Successfully deleted');
|
|
69
|
|
|
return redirect(route('backer'));
|
|
70
|
|
|
}
|
|
71
|
|
|
}
|
|
72
|
|
|
|