Skip to content

Commit 63e5370

Browse files
committed
WIP about to add HTML
1 parent 9ca87e6 commit 63e5370

16 files changed

+630
-51
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\Petition;
6+
use Illuminate\Http\Request;
7+
8+
class AdminPetitionController extends Controller
9+
{
10+
//TODO best way?
11+
// public function __construct()
12+
// {
13+
// $this->middleware('auth');
14+
// }
15+
16+
/**
17+
* Display a listing of the resource.
18+
*
19+
* @return \Illuminate\Http\Response
20+
*/
21+
public function index()
22+
{
23+
24+
$petitions = Petition::all();
25+
// load the view and pass the nerds
26+
27+
28+
return view('admin.petition.index',
29+
[ 'petitions' => $petitions ]);
30+
}
31+
32+
/**
33+
* Show the form for creating a new resource.
34+
*
35+
* @return \Illuminate\Http\Response
36+
*/
37+
public function create()
38+
{
39+
//
40+
}
41+
42+
/**
43+
* Store a newly created resource in storage.
44+
*
45+
* @param \Illuminate\Http\Request $request
46+
* @return \Illuminate\Http\Response
47+
*/
48+
public function store(Request $request)
49+
{
50+
//
51+
}
52+
53+
/**
54+
* Display the specified resource.
55+
*
56+
* @param \App\Petition $petition
57+
* @return \Illuminate\Http\Response
58+
*/
59+
public function show(Petition $petition)
60+
{
61+
return view('admin.petition.show', ['petition' => $petition]);
62+
}
63+
64+
/**
65+
* Show the form for editing the specified resource.
66+
*
67+
* @param \App\Petition $petition
68+
* @return \Illuminate\Http\Response
69+
*/
70+
public function edit(Petition $petition)
71+
{
72+
//
73+
}
74+
75+
/**
76+
* Update the specified resource in storage.
77+
*
78+
* @param \Illuminate\Http\Request $request
79+
* @param \App\Petition $petition
80+
* @return \Illuminate\Http\Response
81+
*/
82+
public function update(Request $request, Petition $petition)
83+
{
84+
//
85+
}
86+
87+
/**
88+
* Remove the specified resource from storage.
89+
*
90+
* @param \App\Petition $petition
91+
* @return \Illuminate\Http\Response
92+
*/
93+
public function destroy(Petition $petition)
94+
{
95+
//
96+
}
97+
}

app/Http/Controllers/Auth/LoginController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class LoginController extends Controller
2525
*
2626
* @var string
2727
*/
28-
protected $redirectTo = '/home';
28+
protected $redirectTo = '/admin/petition';
2929

3030
/**
3131
* Create a new controller instance.
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
class HomeController extends Controller
8+
{
9+
/**
10+
* Create a new controller instance.
11+
*
12+
* @return void
13+
*/
14+
public function __construct()
15+
{
16+
$this->middleware('auth');
17+
}
18+
19+
/**
20+
* Show the application dashboard.
21+
*
22+
* @return \Illuminate\Http\Response
23+
*/
24+
public function index()
25+
{
26+
return view('home');
27+
}
28+
}

config/app.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
| any other location as required by the application or its packages.
1313
*/
1414

15-
'name' => 'Laravel',
15+
'name' => 'Petitions.ly',
1616

1717
/*
1818
|--------------------------------------------------------------------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container">
5+
<div class="row">
6+
<div class="col-md-8 col-md-offset-2">
7+
<div class="panel panel-default">
8+
<div class="panel-heading">Petitions</div>
9+
10+
<div class="panel-body">
11+
<table class="table">
12+
<thead>
13+
<th>title</th>
14+
<th>published</th>
15+
<th></th>
16+
</thead>
17+
@foreach($petitions as $petition)
18+
<tr>
19+
<td>{{ $petition->title}}</td>
20+
<td>{{ $petition->published ? "yes" : "no" }}</td>
21+
<td><a href="{{ URL::route('petition.edit', $petition->id) }}">Edit</a></td>
22+
</tr>
23+
@endforeach
24+
</table>
25+
</div>
26+
27+
</div>
28+
</div>
29+
</div>
30+
</div>
31+
@endsection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container">
5+
<form class="form-horizontal" role="form" method="POST" action="{{ url('/admin/petition') }}">
6+
{{ csrf_field() }}
7+
8+
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
9+
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
10+
11+
<div class="col-md-6">
12+
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
13+
14+
@if ($errors->has('email'))
15+
<span class="help-block">
16+
<strong>{{ $errors->first('email') }}</strong>
17+
</span>
18+
@endif
19+
</div>
20+
</div>
21+
22+
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
23+
<label for="password" class="col-md-4 control-label">Password</label>
24+
25+
<div class="col-md-6">
26+
<input id="password" type="password" class="form-control" name="password" required>
27+
28+
@if ($errors->has('password'))
29+
<span class="help-block">
30+
<strong>{{ $errors->first('password') }}</strong>
31+
</span>
32+
@endif
33+
</div>
34+
</div>
35+
36+
<div class="form-group">
37+
<div class="col-md-6 col-md-offset-4">
38+
<div class="checkbox">
39+
<label>
40+
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
41+
</label>
42+
</div>
43+
</div>
44+
</div>
45+
46+
<div class="form-group">
47+
<div class="col-md-8 col-md-offset-4">
48+
<button type="submit" class="btn btn-primary">
49+
Login
50+
</button>
51+
52+
<a class="btn btn-link" href="{{ url('/password/reset') }}">
53+
Forgot Your Password?
54+
</a>
55+
</div>
56+
</div>
57+
</form>
58+
</div>
59+
@endsection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container">
5+
<div class="row">
6+
<div class="col-md-8 col-md-offset-2">
7+
<div class="panel panel-default">
8+
<div class="panel-heading">Petitions</div>
9+
10+
<div class="panel-body">
11+
12+
<dl>
13+
14+
<dt>Title</dt>
15+
<dd>{{$petition->title}}</dd>
16+
17+
<dt>Published</dt>
18+
<dd>{{$petition->published? 'Yes' : 'No'}}</dd>
19+
20+
<dt>Summary</dt>
21+
<dd>{{$petition->summary}}</dd>
22+
23+
<dt>Body</dt>
24+
<dd>{{$petition->body}}</dd>
25+
26+
27+
</div>
28+
29+
</div>
30+
</div>
31+
</div>
32+
</div>
33+
@endsection

resources/views/auth/login.blade.php

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container">
5+
<div class="row">
6+
<div class="col-md-8 col-md-offset-2">
7+
<div class="panel panel-default">
8+
<div class="panel-heading">Login</div>
9+
<div class="panel-body">
10+
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
11+
{{ csrf_field() }}
12+
13+
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
14+
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
15+
16+
<div class="col-md-6">
17+
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
18+
19+
@if ($errors->has('email'))
20+
<span class="help-block">
21+
<strong>{{ $errors->first('email') }}</strong>
22+
</span>
23+
@endif
24+
</div>
25+
</div>
26+
27+
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
28+
<label for="password" class="col-md-4 control-label">Password</label>
29+
30+
<div class="col-md-6">
31+
<input id="password" type="password" class="form-control" name="password" required>
32+
33+
@if ($errors->has('password'))
34+
<span class="help-block">
35+
<strong>{{ $errors->first('password') }}</strong>
36+
</span>
37+
@endif
38+
</div>
39+
</div>
40+
41+
<div class="form-group">
42+
<div class="col-md-6 col-md-offset-4">
43+
<div class="checkbox">
44+
<label>
45+
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
46+
</label>
47+
</div>
48+
</div>
49+
</div>
50+
51+
<div class="form-group">
52+
<div class="col-md-8 col-md-offset-4">
53+
<button type="submit" class="btn btn-primary">
54+
Login
55+
</button>
56+
57+
<a class="btn btn-link" href="{{ url('/password/reset') }}">
58+
Forgot Your Password?
59+
</a>
60+
</div>
61+
</div>
62+
</form>
63+
</div>
64+
</div>
65+
</div>
66+
</div>
67+
</div>
68+
@endsection
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@extends('layouts.app')
2+
3+
@section('content')
4+
<div class="container">
5+
<div class="row">
6+
<div class="col-md-8 col-md-offset-2">
7+
<div class="panel panel-default">
8+
<div class="panel-heading">Reset Password</div>
9+
<div class="panel-body">
10+
@if (session('status'))
11+
<div class="alert alert-success">
12+
{{ session('status') }}
13+
</div>
14+
@endif
15+
16+
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}">
17+
{{ csrf_field() }}
18+
19+
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
20+
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
21+
22+
<div class="col-md-6">
23+
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
24+
25+
@if ($errors->has('email'))
26+
<span class="help-block">
27+
<strong>{{ $errors->first('email') }}</strong>
28+
</span>
29+
@endif
30+
</div>
31+
</div>
32+
33+
<div class="form-group">
34+
<div class="col-md-6 col-md-offset-4">
35+
<button type="submit" class="btn btn-primary">
36+
Send Password Reset Link
37+
</button>
38+
</div>
39+
</div>
40+
</form>
41+
</div>
42+
</div>
43+
</div>
44+
</div>
45+
</div>
46+
@endsection

0 commit comments

Comments
 (0)