0% found this document useful (0 votes)
448 views

CRUD Operations in Laravel 5 With MYSQL, RESTFUL

The document provides a tutorial for performing CRUD operations in Laravel 5 with MySQL and RESTful routing. It explains how to set up a bookstore application with steps like generating the project files, creating a Book model and controller, setting up the database, and adding views to display a book list and individual book details. Code examples and explanations are provided for tasks like generating scaffolding, defining routes, querying the database, and rendering data to views. The goal is to build a basic application that can create, read, update and delete book records from a MySQL database.

Uploaded by

Aris Budianto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
448 views

CRUD Operations in Laravel 5 With MYSQL, RESTFUL

The document provides a tutorial for performing CRUD operations in Laravel 5 with MySQL and RESTful routing. It explains how to set up a bookstore application with steps like generating the project files, creating a Book model and controller, setting up the database, and adding views to display a book list and individual book details. Code examples and explanations are provided for tasks like generating scaffolding, defining routes, querying the database, and rendering data to views. The goal is to build a basic application that can create, read, update and delete book records from a MySQL database.

Uploaded by

Aris Budianto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

George's Blog (Software Development)

Java, C#, Symfony, Laravel, Android, Xcode, Arduino


Sunday, April 19, 2015

CRUD Operations in Laravel 5 with MYSQL, RESTFUL

CRUD Operations in Laravel 5 with MYSQL, RESTFUL


Here we are to see the changes from laravel 4.3 to laravel 5, At the end of this tutorial, you should be able to create a basic
application in Laravel 5 with MYSQL where you could Create, Read, Update and Delete Books; also we will learn how to use
images in our application. We will use RESTFUL for this tutorial.

1. Create bookstore project


Lets create the project called bookstore; for this in the command line type the following command.
composer create-project laravel/laravel bookstore --prefer-dist

2. Testing bookstore project


Go to the project folder and execute the following command
php artisan serve

Open a web browser and type localhost:8000

Testing bookstore project

Until this point our project is working fine. Otherwise learn how to install Laravel in previous posts.

3. Create database for bookstore


Using your favorite DBMS for MYSQL create a database called library and a table called books with the following fields:

Please make sure you have exactly these fields in your table, specially update_at and created_at, because Eloquent require

them for timestamps.

4. Database setup for bookstore


Here is one of the biggest changes in laravel 5 for security (application and database) Go to bookstore/.env and change
the configuration like shown here:
.env file
APP_ENV=local
APP_DEBUG=true
APP_KEY=tqI5Gj43QwYFzSRhHc7JLi57xhixnDYH
DB_HOST=localhost
DB_DATABASE=library
DB_USERNAME=root
DB_PASSWORD=your_mysql_password
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null

5. Create book controller for bookstore


In the command line locate inside your library project type the following command:
php artisan make:controller BookController

Just make sure a new class was created in bookstore/app/Http/Controllers


BookController.php file
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class BookController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{

//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}

6. Create book model


In the command line type the following command:
php artisan make:model Book

A new class was created in bookstore/app/


Book.php file
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Book extends Model {
//
}

7. Install Form and Html Facades


In order to use Form and Html facades in laravel 5 as they are being removed from core in 5 and will need to be added as
an optional dependency: Type the follow command:
composer require illuminate/html

After successful installation we will get the following message

Using version ~5.0 for illuminate/html


./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing illuminate/html (v5.0.0)
Loading from cache
Writing lock file
Generating autoload files
Generating optimized class loader

Add in providers config/app.php the following line of code


'Illuminate\Html\HtmlServiceProvider',

Add in aliases config/app.php the following lines of code


'Form'
'Html'

=> 'Illuminate\Html\FormFacade',
=> 'Illuminate\Html\HtmlFacade',

8. Restful Controller
In laravel 5, a resource controller defines all the default routes for a given named resource to follow REST principles, where
we could find more information about it. So when you define a resource in your bookstore/app/Http/routes.php like:
routes.php file
<?php
/*
|-------------------------------------------------------------------------| Application Routes
|-------------------------------------------------------------------------|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
/*
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);*/
Route::resource('books','BookController');

As we can see we block the original code to avoid the default authentication laravel created for us.
A restful controller follows the standard blueprint for a restful resource, which mainly consists of:
Domain

Method

URI

Name

Action

GET|HEAD

books

books.index

App\Http\Controllers\BookController@index

GET|HEAD

books/create

books.create

App\Http\Controllers\BookController@create

POST

books

books.store

App\Http\Controllers\BookController@store

GET|HEAD

books/{books}

books.show

App\Http\Controllers\BookController@show

GET|HEAD

books/{books}/edit

books.edit

App\Http\Controllers\BookController@edit

PUT

books/{books}

books.update

App\Http\Controllers\BookController@update

PATCH

books/{books}

DELETE

books/{books}

App\Http\Controllers\BookController@update
books.destroy

To get the table from above; type in the command line:


php artisan route:list

App\Http\Controllers\BookController@destroy

Midleware

9. Insert dummy data


Until this point our project is ready to implement our CRUD operation using Laravel 5 and MySQL, insert some dummy data
in the table we created in step 3.

In order to display images for books cover we need to create a folder called img inside bookstore/public and download
some books cover picture and rename the name according to the field image in our table as shown above with extension
jpg.

10. Create layout for bookstore


Go to folder bookstore/resources/view and create a new folder called layout; inside that new folder create a php file called
template.blade.php and copy the following code:
template.blade.php file
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BookStore</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap
/3.3.4/css/bootstrap.min.css">
</head>
<body>
<div class="container">
@yield('content')
</div>
</body>
</html>

11. Create view to show book list


Now let's try to fetch books from our database via the Eloquent object. For this let's modify the index method in our
app/Http/Controllers/BookController.php. and modify like show bellow.(note that we added use App\Book, because we
need to make reference to Book model)
<?php namespace App\Http\Controllers;
use App\Book;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class BookController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
$books=Book::all();
return view('books.index',compact('books'));
}

To display book list we need to create a view: Go to folder bookstore/resources/view and create a folder called books;
inside this new folder create a new file called index.blade.php and copy the following code

index..blade.php file
@extends('layout/template')
@section('content')
<h1>Peru BookStore</h1>
<a href="{{url('/books/create')}}" class="btn btn-success">Create Book</a>
<hr>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr class="bg-info">
<th>Id</th>
<th>ISBN</th>
<th>Title</th>
<th>Author</th>
<th>Publisher</th>
<th>Thumbs</th>
<th colspan="3">Actions</th>
</tr>
</thead>
<tbody>
@foreach ($books as $book)
<tr>
<td>{{ $book->id }}</td>
<td>{{ $book->isbn }}</td>
<td>{{ $book->title }}</td>
<td>{{ $book->author }}</td>
<td>{{ $book->publisher }}</td>
<td><img src="{{asset('img/'.$book->image.'.jpg')}}" height="35" width="30"></td>
<td><a href="{{url('books',$book->id)}}" class="btn btn-primary">Read</a></td>
<td><a href="{{route('books.edit',$book->id)}}" class="btn btn-warning">Update</a></td>
<td>
{!! Form::open(['method' => 'DELETE', 'route'=>['books.destroy', $book->id]]) !!}
{!! Form::submit('Delete', ['class' => 'btn btn-danger']) !!}
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection

Lets see how our book list are displayed; in the command like type php artisan serve, after open a browser and type
localhost:8888/books

12. Read book(Display single book)


Lets implement Read action, create a new file in bookstore/resources/view/books called show.blade.php and paste the
code:
show.blade.php file
@extends('layout/template')
@section('content')

<h1>Book Show</h1>
<form class="form-horizontal">
<div class="form-group">
<label for="image" class="col-sm-2 control-label">Cover</label>
<div class="col-sm-10">
<img src="{{asset('img/'.$book->image.'.jpg')}}" height="180" width="150" class="img-rounded">
</div>
</div>
<div class="form-group">
<label for="isbn" class="col-sm-2 control-label">ISBN</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="isbn" placeholder={{$book->isbn}} readonly>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="title" placeholder={{$book->title}} readonly>
</div>
</div>
<div class="form-group">
<label for="author" class="col-sm-2 control-label">Author</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="author" placeholder={{$book->author}} readonly>
</div>
</div>
<div class="form-group">
<label for="publisher" class="col-sm-2 control-label">Publisher</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="publisher" placeholder={{$book->publisher}} readonly>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<a href="{{ url('books')}}" class="btn btn-primary">Back</a>
</div>
</div>
</form>
@stop

Modify app/Http/Controllers/BookController.php
public function show($id)
{
$book=Book::find($id);
return view('books.show',compact('book'));
}

Refresh the brower and click in Read action and we will see the book in detail:

13. Create book


Create a new file in bookstore/resources/view/books called create.blade.php and paste the code:
create.blade.php file
@extends('layout.template')
@section('content')
<h1>Create Book</h1>
{!! Form::open(['url' => 'books']) !!}
<div class="form-group">
{!! Form::label('ISBN', 'ISBN:') !!}
{!! Form::text('isbn',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Title', 'Title:') !!}
{!! Form::text('title',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Author', 'Author:') !!}
{!! Form::text('author',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Publisher', 'Publisher:') !!}
{!! Form::text('publisher',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Image', 'Image:') !!}
{!! Form::text('image',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit('Save', ['class' => 'btn btn-primary form-control']) !!}
</div>
{!! Form::close() !!}
@stop

Modify app/Http/Controllers/BookController.php

public function create()


{
return view('books.create');
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$book=Request::all();
Book::create($book);
return redirect('books');
}

Now we need to modify the Book model for mass assignment


<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Book extends Model {
//
protected $fillable=[
'isbn',
'title',
'author',
'publisher',
'image'
];
}

refresh the Brower and click on create Book

14. Update Book


Create a new file in bookstore/resources/view/books called edit.blade.php and paste the code:
edit.blade.php file
@extends('layout.template')
@section('content')
<h1>Update Book</h1>
{!! Form::model($book,['method' => 'PATCH','route'=>['books.update',$book->id]]) !!}
<div class="form-group">

{!! Form::label('ISBN', 'ISBN:') !!}


{!! Form::text('isbn',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Title', 'Title:') !!}
{!! Form::text('title',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Author', 'Author:') !!}
{!! Form::text('author',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Publisher', 'Publisher:') !!}
{!! Form::text('publisher',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('Image', 'Image:') !!}
{!! Form::text('image',null,['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit('Update', ['class' => 'btn btn-primary']) !!}
</div>
{!! Form::close() !!}
@stop

Modify app/Http/Controllers/BookController.php
public function edit($id)
{
$book=Book::find($id);
return view('books.edit',compact('book'));
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
$bookUpdate=Request::all();
$book=Book::find($id);
$book->update($bookUpdate);
return redirect('books');
}

refresh the brower, select the book and click Update button

15. Delete Book


Delete is easy just modify app/Http/Controllers/BookController.php
public function destroy($id)
{
Book::find($id)->delete();
return redirect('books');
}

Refresh the Brower and click in delete button for deleting one book and redirect to book list.
Jorge Serrano at 4:45 AM
Share

15

87 comments:
Traiano Welcome May 2, 2015 at 10:28 AM
Excellent learning resource! Thank you :-)
Reply

Traiano Welcome May 2, 2015 at 1:33 PM


How would you get Laravel's basic authentication working with this?
Reply

Abdullah Al Mamun May 6, 2015 at 6:35 AM


very nice i want to learn from u
Reply

deki kurnia May 25, 2015 at 8:49 PM


hi. please share your code to github
Reply

Md. Gsk June 3, 2015 at 1:53 AM


Just owsm...!!!
If you have any other post on laravel 5, please give me the link, I want to learn more from you.
Reply

Thejesh PR June 3, 2015 at 9:40 PM


Awesome Example....but im getting error in new book create method
error description:
ErrorException in BookController.php line 42:
Non-static method Illuminate\Http\Request::all() should not be called statically, assuming $this from incompatible context
Reply
Replies
Boomi Nathan June 4, 2015 at 2:33 AM
yes me too !!

HAASAAH June 5, 2015 at 9:49 AM


try change the declaration:
#use Illuminate\Http\Request;
by:
#use Request;
Regards.

Ferry Chrisnandika July 22, 2015 at 1:10 AM


or if you still want to apply
use Illuminate\Http\Request;
just change your code a little bit,
from :
public function store()
{
$book=Request::all();
Book::create($book);
return redirect('books');
}
to:
public function store(Request $request)
{
$book=$request->all(); // important!!
Book::create($book);

return redirect('books');
}
works with update too :)
courtesy of http://stackoverflow.com/questions/28573860/laravel-requestall (comment from shock_gone_wild)
Reply

Boomi Nathan June 4, 2015 at 2:30 AM


You forgot to Call the model in controller Please Add it !!
Reply
Replies
Ehtesham Mehmood June 7, 2015 at 1:15 PM
Can you tell me how to call Model in Controller ?

worlanyo June 7, 2015 at 7:52 PM


Please how do you call the Model in Controller?
Reply

worlanyo June 7, 2015 at 7:54 PM


Please i am getting this error after creating the index.blade.php file and adding the necessary code.Please what am i doing wrong.
Whoops, looks like something went wrong.
1/1
FatalErrorException in BookController.php line 18:
Class 'App\Http\Controllers\Book' not found
in BookController.php line 18
Reply
Replies
jaahvicky June 8, 2015 at 8:29 AM
Add this to your controller - use App\Lotto;

worlanyo June 8, 2015 at 7:27 PM


thank you, i got it working.

farid messi June 20, 2015 at 7:53 PM


add this use App/Book;
Reply

Raja Syahmudin June 18, 2015 at 11:49 PM


This comment has been removed by the author.
Reply

farid messi June 20, 2015 at 8:01 PM


I have a problem
Why do not my images appear ?
please help me.
Reply
Replies
suparman elmizan June 21, 2015 at 3:19 AM
create folder img on bookstore/public/ and store your image manually there
Reply

ririn nayo June 21, 2015 at 6:40 AM


thanks :3 awsome
Reply

Bittu Sara Luke June 23, 2015 at 11:13 PM


Awesome Blog. Thank you so much :) . I have one problem in my project. I have keep all my models in App/models directory. I have
used this blog to develop my work. All other CURD operations are working fine except Delete. Can you please help me to resolve the
error?
Reply

worlanyo June 25, 2015 at 8:41 AM


I started the project all over again and i am getting this error. i got to step 11. i am not sure if it is because i am using a newer version
of laravel. 5.1.2.
Sorry, the page you are looking for could not be found.
NotFoundHttpException in RouteCollection.php line 143:
in RouteCollection.php line 143
at RouteCollection->match(object(Request)) in Router.php line 744
at Router->findRoute(object(Request)) in Router.php line 653
at Router->dispatchToRoute(object(Request)) in Router.php line 629
at Router->dispatch(object(Request)) in Kernel.php line 229
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line
124

at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61


at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in
Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php
line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 118
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 86
at Kernel->handle(object(Request)) in index.php line 54
at require_once('C:\xampp\htdocs\Projects\Laravel_Projects\LearningSite2\public\index.php') in server.php line 21
Reply
Replies
Eder Wei July 1, 2015 at 8:42 AM
Hi, add:
Route::resource('books','BookController');
In:
bookstore/app/Http/routes.php

Sudarshan Shrestha July 20, 2015 at 1:37 AM


same
prblm
bt
addding
Route::resource('books','BookController@index');

bipin August 9, 2015 at 1:19 PM


I got the same problem. I have used
Route::resource('books','BookController');
in routes.php file.
Whta mihht be other isssues?
Reply

Eder Wei July 1, 2015 at 8:43 AM


Great post!! Thank you very much
Reply

MITHILESH KUMAR JHA July 3, 2015 at 5:14 AM


Nice post but unable to save and update data from mysql :)
Reply

Route::resource('Books','BookController')in

place

of

Replies
Ferry Chrisnandika July 22, 2015 at 1:19 AM
or if you still want to apply
use Illuminate\Http\Request;
just change your code a little bit,
from :
public function store()
{
$book=Request::all();
Book::create($book);
return redirect('books');
}
to:
public function store(Request $request)
{
$book=$request->all(); // important!!
Book::create($book);
return redirect('books');
}
works with update too :)
courtesy of http://stackoverflow.com/questions/28573860/laravel-requestall (comment from shock_gone_wild)
Reply

Chavez July 6, 2015 at 9:01 PM


https://github.com/chavewain/laravel-book-store.git
Download the code
Reply

Vicky Bagaskoro July 8, 2015 at 9:22 PM


i got this messages :
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bookstore.books' doesn't exist (SQL: select * from `books`)

My table is 'book', how to fixed?


Reply

Akira The Great July 9, 2015 at 8:46 PM


rename your table name. Laravel 5 very sensitive with 's'.
Reply

Fernando July 15, 2015 at 6:12 PM

the code show the following message


Non-static method Illuminate\Http\Request::all() should not be called statically, assuming $this from incompatible context
Reply
Replies
Unknown November 18, 2015 at 5:31 PM
If you using:
use Illuminate\Http\Request;
Pls use: $request->all();
and using use Request;
Pls use: Request->all()
Reply

akhid July 16, 2015 at 4:50 AM


hy george, nice tutorials, work with me, please can you add file image upload proses,
Reply

have stuff July 31, 2015 at 11:56 PM


hi,
this is very nice tutorials and i created step by step as you given and every thing working like show,create and list but when i click on
edit then it display
NotFoundHttpException in RouteCollection.php line 145:
i have seen that for create it working so as logically why not edit opened.
please give me the solution for that so i can go ahead...
Thanks...
Reply

freddy sidauruk August 1, 2015 at 2:35 PM


why the input type file in my project looks like input teype text and you didn't tell about upload images to folder >.< if anyone has
solved this issue please kindly comment here, Thanks
Reply

freddy sidauruk August 1, 2015 at 2:44 PM


Lol this explanation didn't tell CRUD upload images, a common CRUD :D
Reply

gARUda August 3, 2015 at 3:39 AM


Nice resource
Reply

INSPIRATIONS CHANNEL August 12, 2015 at 1:31 AM

Excellent blog..It as helped me alot


Reply

ngelo August 27, 2015 at 12:58 PM


Very good tutorial please keep writing. I am using the last version and running php artisan route:list you see error messages about
provider and then aliases
I fix trying :
into providers:
Illuminate\Html\HtmlServiceProvider::class,
into aliases:
'Form' => Illuminate\Html\FormFacade\View::class,
'Html' => Illuminate\Html\HtmlFacade\View::class,
Reply

filipe gil Mabjaia September 8, 2015 at 9:26 AM


I'm having trouble putting the artisan serve php, to run the same shows an invalid request error (unexpected eof)
Reply

filipe gil Mabjaia September 8, 2015 at 9:28 AM


I'm having trouble putting the artisan serve php, to run the same shows an invalid request error (unexpected eof)
pls help me
Reply

vivek swaminathan September 10, 2015 at 6:20 AM


NotFoundHttpException in RouteCollection.php line 143:
in RouteCollection.php line 143
at RouteCollection->match(object(Request)) in Router.php line 746
at Router->findRoute(object(Request)) in Router.php line 655
at Router->dispatchToRoute(object(Request)) in Router.php line 631
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line
124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in

Pipeline.php line 124


at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php
line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
what to do????to overcome this issue....
even though i had added resource controller in routes.php
Reply

Julian Jupiter September 12, 2015 at 10:54 AM


Nice tutorial! As a beginner, I learned a lot. I just want to ask, how do I display the book image? This tutorial seems to have missed
out to discuss how to display the book image. Thanks.
Reply
Replies
Julian Jupiter September 12, 2015 at 11:48 AM
Oh... got it, i just move img folder inside public folder
Reply

Unknown September 21, 2015 at 2:07 AM


hi! I have tried, but the update function is not working. Please help me to fix this.
Reply
Replies
Nguyn Ngc Nhin November 18, 2015 at 5:40 PM
Please show some errors on your screen???
Reply

Eder Wei October 6, 2015 at 9:48 PM


Thank you very much!! PHP Rebirth!!
Reply

Eder Wei October 8, 2015 at 9:23 AM


I love Laravel 5 (PHP), Struts2 & Spring MVC (Java), ASP.NET MVC (.NET), Ruby on Rails (Ruby) and Django (Python) !!
Reply

Muhammad Tahir Wazir October 9, 2015 at 9:14 AM


This comment has been removed by the author.
Reply

Muhammad Tahir Wazir October 9, 2015 at 11:09 AM


1/1
FatalErrorException in C:\xampp\htdocs\laravel\shop\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php
line 146:
Class 'Illuminate\Html\HtmlServiceProvider' not found
Reply

Raj Thakkar November 2, 2015 at 10:40 PM


Nice Post! This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps
me in many ways.Thanks for posting this again. Thanks a million and please keep up the effective work Thank yo so much for
sharing this kind of info- hire laravel developer
Reply

Bangkit Wira November 5, 2015 at 12:26 AM


Why my books from database not shows?
Reply
Replies
Nguyn Ngc Nhin November 18, 2015 at 5:39 PM
Did you insert data yet?
Reply

Rifqi Ahmad Pramudito November 10, 2015 at 11:51 PM


Thank you so much :*
Reply

binod maharjan November 24, 2015 at 8:33 AM


its a wonderful tutorial for beginners like me. Hats off to you.
Reply

Unknown December 5, 2015 at 12:23 PM


How to insert the image in create...while inserting a new book , how to add an image also
Reply

Sachin Bhardwaj December 21, 2015 at 3:25 AM


hi i am getting error when i update entry..

ErrorException in BookController.php line 84:


Non-static method Illuminate\Http\Request::all() should not be called statically, assuming $this from incompatible context
Reply

Sachin Bhardwaj December 21, 2015 at 3:27 AM


and when i create new entry after fill form then save getting error
ErrorException in BookController.php line 45:
Non-static method Illuminate\Http\Request::all() should not be called statically, assuming $this from incompatible context
Reply

Unknown January 4, 2016 at 2:26 AM


excellent post!
Reply

Abhilash Mandaliya January 5, 2016 at 1:18 AM


excellent tutorial man ! thank you very much. love you. :)
Reply

Brian Kisese January 14, 2016 at 12:02 AM


Excellent Tutorial,this has really helped me in learning the framework
Reply

Unknown January 21, 2016 at 12:48 AM


pls also include validator for the forms? thank you.
Reply

aizat yahya January 26, 2016 at 7:33 PM


This comment has been removed by the author.
Reply

Manikandan C January 29, 2016 at 8:41 PM


image does not appear in show page what i do?
Reply
Replies
Manuja February 7, 2016 at 5:31 AM
It is working friend.Place them in correct location and give permission to the folder if use linux.Save the image name
correctly in database.
Reply

Manuja February 7, 2016 at 5:28 AM


Nice article.Good to start Laravel here.Read others comments to understand bugs and solove them. -Ujitha SudasinghaReply

Diego M February 15, 2016 at 11:28 AM


Hello, i have a question: why the Title of the books is truncated at the show view?
Btw, nice article
Reply
Replies
Khalil Mohamed February 17, 2016 at 5:12 PM
you should modify show.blad.php :
change placeholder={{$article->title}}
to : value="{{$article->title}}"
Reply

syehbi herbian February 17, 2016 at 7:33 AM


i have a problem
InvalidArgumentException in FileViewFinder.php line 140:
View [books.index] not found.
Reply

Rafi Oktavian February 23, 2016 at 4:09 AM


thank's for your article :D
Reply

Hiren Kukadiya February 26, 2016 at 3:39 AM


FatalErrorException in HtmlServiceProvider.php line 36: Call to undefined method Illuminate\Foundation\Application::bindShared()
Reply

Sunil Dandwate February 27, 2016 at 7:18 PM


Hi Jorge, Thanks for this great article, I learn too much from this article. Please can you write any article for file upload.
Reply

Rufu Tech February 29, 2016 at 4:38 AM


Hi guys
really i have seen your post very useful content this post thanks for sharing software development
Reply

Unknown February 29, 2016 at 9:42 AM


thanks for your short and nice tutorial. Appreciate your job.
Reply

Moiss Augusto March 21, 2016 at 8:25 AM


Hi guys,
Tks for this tutorial :)
I have just one case in updated session. An error when I write the form method PATCH in edit.blade.php (Laravel 5.2)
MethodNotAllowedHttpException in RouteCollection.php line 219:
1. in RouteCollection.php line 219
2. At RouteCollection->methodNotAllowed(array('GET','HEAD','POST')) in RouteCollection.php line 206
3...
Please, someone had this issue already? Can help me?
Tks in advance
Reply

danno shapril m March 25, 2016 at 2:53 AM


FatalErrorException in Facade.php line 218: Call to undefined method Illuminate\Html\FormFacade::open()
Reply

anil March 28, 2016 at 10:31 AM

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'D:\xampp\htdocs\Laravel/server.php' (include_path='.;D:\xampp\php\PEAR') in
Unknown on line 0
Reply
Replies
anil March 28, 2016 at 10:33 AM
plz reply fast
Reply

zohaib ullah baig April 5, 2016 at 12:16 AM


Thanks
Reply

Unknown April 15, 2016 at 5:10 AM

Excellent Tutorial
Reply

Parth Shukal April 26, 2016 at 6:26 AM


If you get
"Call to undefined method Illuminate\Foundation\Application::bindShared()"
this error--Then Goto:
path-to-your-project/vendor/illuminate/html/HtmlServiceProvider.php
replace: bindShared() with singleton() on line no : 36 and 49
Reply

morphin paul April 26, 2016 at 10:05 AM


We can dynamically create crud in laravel and other frameworks using http://crudgenerator.in
Reply

morphin paul May 2, 2016 at 11:48 AM


Plz try http://crudgenerator.in
This can generate crud in laravel with your input dynamically
Reply

Dhanapal Madheswaran May 3, 2016 at 5:46 AM


Thanks a Lot ...Great tutorial...
Reply

nurtannio muhammad May 7, 2016 at 3:54 AM


FatalErrorException in HtmlServiceProvider.php line 36:
Call to undefined method Illuminate\Foundation\Application::bindShared()
Reply

Unknown May 8, 2016 at 12:32 AM


how can we connect this crud application with laravel default authentication??
Reply

Enter your comment...

Comment as:

Publish

riztboed (Google)

Sign out

Notify me

Preview

Home

View web version

About Me

Jorge Serrano
Follow

86

Software Developer with 10 years experience in full life-cycle development, including analysis, design, development, testing,
documentation, implementation, and maintenance of application software in web-based/desktop environment, distributed Ntier architecture, and client/server architecture.
Experience in designing and developing object-oriented software applications, ranging from e-business, asset management, and Internet and
intranet applications.
Sound knowledge of developing applications based on architectures such as Hibernate Framework, Spring Framework, and MVC architecture.
Experience in implementing core Java & J2EE design patterns, Solid understanding of business needs and requirements
Strong management, planning, architecting, analyzing, designing, and programming capabilities.
Excellent analytical, problem solving, communication, and team skills.
View my complete profile
Powered by Blogger.

You might also like