Answered by : 13garth
php artisan make:view viewName
Source : | Last Update : Wed, 30 Jun 21
Answered by : handsome-hippopotamus-y4ejl5k89f2e
composer require spatie/laravel-view-models
Source : https://github.com/spatie/laravel-view-models | Last Update : Sun, 14 Mar 21
Answered by : handsome-hippopotamus-y4ejl5k89f2e
<input type="text" value="{{ $post->title }}" />
<input type="text" value="{{ $post->body }}" />
<select> @foreach ($categories as $category) <option value="{{ $category->id }}">{{ $category->name }}</option> @endforeach
</select>
<a href="{{ $indexUrl }}">Back</a>
Source : https://github.com/spatie/laravel-view-models | Last Update : Sun, 14 Mar 21
Answered by : handsome-hippopotamus-y4ejl5k89f2e
php artisan make:view-model HomepageViewModel
Source : https://github.com/spatie/laravel-view-models | Last Update : Sun, 14 Mar 21
Answered by : handsome-hippopotamus-y4ejl5k89f2e
php artisan make:view-model "Blog/PostsViewModel"
Source : https://github.com/spatie/laravel-view-models | Last Update : Sun, 14 Mar 21
Answered by : handsome-hippopotamus-y4ejl5k89f2e
class PostViewModel extends ViewModel
{ protected $ignore = ['ignoredMethod']; // … public function ignoredMethod() { /* … */ }
}
Source : https://github.com/spatie/laravel-view-models | Last Update : Sun, 14 Mar 21
Answered by : handsome-hippopotamus-y4ejl5k89f2e
class PostsController
{ public function update(Request $request, Post $post) { // … return new PostViewModel($post); }
}
Source : https://github.com/spatie/laravel-view-models | Last Update : Sun, 14 Mar 21
Answered by : misty-mandrill-7n956ol0e6aq
Laravel_View
Source : | Last Update : Mon, 18 Jul 22
Answered by : handsome-hippopotamus-y4ejl5k89f2e
class PostsController
{ public function update(Request $request, Post $post) { // … return (new PostViewModel($post))->view('post.form'); }
}
Source : https://github.com/spatie/laravel-view-models | Last Update : Sun, 14 Mar 21
Answered by : misty-mandrill-7n956ol0e6aq
Laravel_View_2
Source : | Last Update : Mon, 18 Jul 22