Skip to content

Commit 83457ff

Browse files
Update for Laraval 5.4 and remove LaravelCollective dependency
1 parent 7e05ea8 commit 83457ff

File tree

13 files changed

+65
-52
lines changed

13 files changed

+65
-52
lines changed

app/Events/OtherTestEvent.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
class OtherTestEvent extends Event
6+
{
7+
8+
}

app/Http/Controllers/HomeController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php namespace App\Http\Controllers;
22

33
use App\Events\TestEvent;
4+
use App\Events\OtherTestEvent;
45
use Illuminate\Http\Request;
56
use Illuminate\Support\Facades\Session;
67

@@ -64,7 +65,7 @@ public function secure()
6465
*/
6566
public function session(Request $request, $message)
6667
{
67-
$request->session()->set('message', $message);
68+
$request->session()->put('message', $message);
6869
}
6970

7071
/**
@@ -91,6 +92,7 @@ public function specialCharacters()
9192
public function fireEvent()
9293
{
9394
event(new TestEvent());
95+
event(new OtherTestEvent());
9496

9597
return '';
9698
}

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"license": "MIT",
66
"type": "project",
77
"require": {
8-
"laravel/framework": "5.3.*",
9-
"laravelcollective/html": "5.3.*",
8+
"laravel/framework": "5.4.*",
109
"flow/jsonpath": "^0.2.4",
1110
"fzaninotto/faker": "~1.4"
1211
},

config/app.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@
153153
'App\Providers\ConfigServiceProvider',
154154
'App\Providers\EventServiceProvider',
155155
'App\Providers\RouteServiceProvider',
156-
157-
'Collective\Html\HtmlServiceProvider',
158156
],
159157

160158
/*
@@ -202,9 +200,6 @@
202200
'URL' => 'Illuminate\Support\Facades\URL',
203201
'Validator' => 'Illuminate\Support\Facades\Validator',
204202
'View' => 'Illuminate\Support\Facades\View',
205-
206-
'Html' => 'Collective\Html\HtmlFacade',
207-
'Form' => 'Collective\Html\FormFacade'
208203
],
209204

210205
];

resources/views/form.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
Your message: {{ $message }}
66
</p>
77

8-
{!! Form::open() !!}
9-
{!! Form::text('message') !!}
10-
{!! Form::submit('Submit') !!}
11-
{!! Form::close() !!}
8+
<form action="/form">
9+
<input type="text" name="message">
10+
<input type="submit" value="Submit">
11+
</form>
1212
@stop

resources/views/posts/create.blade.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44

55
<h1>Create Post</h1>
66

7-
{!! Form::open(array('route' => 'posts.store')) !!}
7+
<form method="post" action="/posts">
8+
{{ csrf_field() }}
89
<ul>
910
<li>
10-
{!! Form::label('title', 'Title:') !!}
11-
{!! Form::text('title') !!}
11+
<label for="title">Title:</label>
12+
<input type="text" id="title" name="title" value="{{ old('title') }}">
1213
</li>
1314

1415
<li>
15-
{!! Form::label('body', 'Body:') !!}
16-
{!! Form::textarea('body') !!}
16+
<label for="body">Body:</label>
17+
<textarea id="body" name="body" cols="30" rows="10">{{ old('body') }}</textarea>
1718
</li>
1819

1920
<li>
20-
{!! Form::submit('Submit', array('class' => 'btn')) !!}
21+
<input type="submit" value="Submit" class="btn">
2122
</li>
2223
</ul>
23-
{!! Form::close() !!}
24+
</form>
2425

2526
@if ($errors->any())
2627
<ul>

resources/views/posts/edit.blade.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@
33
@section('main')
44

55
<h1>Edit Post</h1>
6-
{!! Form::model($post, array('method' => 'PATCH', 'route' => array('posts.update', $post->id))) !!}
6+
<form method="post" action="/posts/{{ $post->id }}">
7+
{{ csrf_field() }}
8+
{{ method_field('patch') }}
79
<ul>
810
<li>
9-
{!! Form::label('title', 'Title:') !!}
10-
{!! Form::text('title') !!}
11+
<label for="title">Title:</label>
12+
<input type="text" id="title" name="title" value="{{ old('title', $post->title) }}">
1113
</li>
1214

1315
<li>
14-
{!! Form::label('body', 'Body:') !!}
15-
{!! Form::textarea('body') !!}
16+
<label for="body">Body:</label>
17+
<textarea id="body" name="body" cols="30" rows="10">{{ old('body', $post->body) }}</textarea>
1618
</li>
1719

1820
<li>
19-
{!! Form::submit('Update', array('class' => 'btn btn-info')) !!}
20-
{!! link_to_route('posts.show', 'Cancel', $post->id, array('class' => 'btn')) !!}
21+
<input type="submit" value="Update" class="btn btn-info">
22+
<a href="/posts/{{ $post->id }}" class="btn">Cancel</a>
2123
</li>
2224
</ul>
23-
{!! Form::close() !!}
25+
</form>
2426

2527
@if ($errors->any())
2628
<ul>

resources/views/posts/index.blade.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<h1>All Posts</h1>
66

7-
<p>{!! link_to_route('posts.create', 'Add new post') !!}</p>
7+
<p><a href="/posts/create">Add new post</a></p>
88

99
@if ($posts->count())
1010
<table class="table table-striped table-bordered">
@@ -20,11 +20,13 @@
2020
<tr>
2121
<td>{{ $post->title }}</td>
2222
<td>{{ $post->body }}</td>
23-
<td>{!! link_to_route('posts.edit', 'Edit', array($post->id), array('class' => 'btn btn-info')) !!}</td>
23+
<td><a href="/posts/{{ $post->id }}/edit" class="btn btn-info">Edit</a></td>
2424
<td>
25-
{!! Form::open(array('method' => 'DELETE', 'route' => array('posts.destroy', $post->id))) !!}
26-
{!! Form::submit('Delete', array('class' => 'btn btn-danger')) !!}
27-
{!! Form::close() !!}
25+
<form method="post" action="/posts/{{ $post->id }}">
26+
{{ csrf_field() }}
27+
{{ method_field('delete') }}
28+
<input type="submit" value="Delete" class="btn btn-danger">
29+
</form>
2830
</td>
2931
</tr>
3032
@endforeach

resources/views/posts/show.blade.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<h1>Show Post</h1>
66

7-
<p>{!! link_to_route('posts.index', 'Return to all posts') !!}</p>
7+
<p><a href="/posts">Return to all posts</a></p>
88

99
<table class="table table-striped table-bordered">
1010
<thead>
@@ -18,11 +18,13 @@
1818
<tr>
1919
<td>{{ $post->title }}</td>
2020
<td>{{ $post->body }}</td>
21-
<td>{!! link_to_route('posts.edit', 'Edit', array($post->id), array('class' => 'btn btn-info')) !!}</td>
21+
<td><a href="/posts/{{ $post->id }}/edit" class="btn btn-info">Edit</a></td>
2222
<td>
23-
{!! Form::open(array('method' => 'delete', 'route' => array('posts.destroy', $post->id))) !!}
24-
{!! Form::submit('Delete', array('class' => 'btn btn-danger')) !!}
25-
{!! Form::close() !!}
23+
<form method="post" action="/posts/{{ $post->id }}">
24+
{{ csrf_field() }}
25+
{{ method_field('delete') }}
26+
<input type="submit" value="Delete" class="btn btn-danger">
27+
</form>
2628
</td>
2729
</tr>
2830
</tbody>

resources/views/users/edit.blade.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
@section('main')
44

55
<h1>Edit User</h1>
6-
{!! Form::model($user, array('method' => 'PATCH', 'route' => array('users.update', $user->id))) !!}
7-
<ul>
8-
<li>
9-
{!! Form::label('email', 'Email') !!}
10-
{!! Form::text('email') !!}
11-
</li>
12-
<li>
13-
{!! Form::submit('Update', array('class' => 'btn btn-info')) !!}
14-
{!! link_to_route('users.show', 'Cancel', $user->id, array('class' => 'btn')) !!}
15-
</li>
16-
</ul>
17-
{!! Form::close() !!}
6+
<form method="post" action="/users/{{ $user->id }}">
7+
{{ csrf_field() }}
8+
{{ method_field('patch') }}
9+
<ul>
10+
<li>
11+
<label for="email">Email</label>
12+
<input type="text" id="email" name="email" value="{{ old('email', $user->email) }}">
13+
</li>
14+
<li>
15+
<input type="submit" value="Update" class="btn btn-info">
16+
<a href="/users/{{ $user->id }}" class="btn">Cancel</a>
17+
</li>
18+
</ul>
19+
</form>
1820

1921
@if ($errors->any())
2022
<ul>

0 commit comments

Comments
 (0)