Laravel 5.8 CRUD operation with example

In this tutorial we will learn how we can create a project in CRUD (Create, Read, Update and Delete) operations through Laravel. We will get to know how to create, update read and delete in Laravel from Scratch.

Initially have to download Laravel 5.8 version. For this you have to go to command prompt, in which first we have go to our folder path in which we want to download Laravel 5.8. After this we have to run “composer” command, because all Laravel depository is handled by composer. After run “composer” command we have to run following command:

composer create-project laravel/laravel=5.8 crud --prefer-dist

After downloading Laravel 5.8, we have to make Mysql database connection from Laravel 5.8.

We have to find .env file in your Laravel 5.8 folder. Open that file and under we have to define our mysql database before that we have to create a database in our mysql named as ‘crud’ and then we have to configure our .env as given below.


After this we have to create migration file in our Laravel folder. For this we have to write following command in your command prompt.

php artisan make:migration create_crud_table --create=crud

This command will create migration file in database/migrations folder. In this file we have to define table column which we want to create in table. Below we can find migration file in which we have define table column.

Now we want to migrate this table definition from this Laravel application to mysql database. For this we have write following command in command prompt. This command will make crud table in mysql database for perform CRUD operation from Laravel 5.8 application.

php artisan migrate

Now we have to create model for our database which is used for operations in controller class. To create a model we will run the command given below.

php artisan make:model Crud -m

This command will make Crud.php model file in app folder. In this file we have to define table column name which we can see below source code of Crud.php file.

Now we have to create Laravel 5.8 crud controller. For this we have to go to command prompt and under this we have write following command.

php artisan make:controller CrudsController --resource

This command will make CrudsController.php file in app/Http/Controllers folder. Once we open this file, we can find all predefine method for do CRUD operation in this controller file. We have to just add code for doing particular operation. Below we can find CRUD controller file code.

Now we have to set route of all CrudsController class method. For this we have to open to routes/web.php file. In this file we have to write following code for set route of all method.


Now in this step we have to set data in view file which has been store under resources/views folder, because this view file has received data from controller method, so here we have to set data in view file. Below we can find all view file which has been used in Crud application, and we can also find how data has been set and how to make form in Laravel 5.8 view file.

Now we can run the Laravel 5.8 Crud application, for this we have to go to command prompt, and write following command.

php artisan serve

For reference you can see the video given below:

Tagged :

How to Create Virtual Host in Laravel

In this tutorial I’m going to create multiple virtual host in laravel in some easy steps please follow mentioned below.

first stop your xampp 👇

1step-> Go to


ds-admin-ms is your project folder name


2nd step go to


3rd step Open this file -> httpd-vhosts.conf

4th step Copy below code 👇👇

<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\ds-admin-ms\public"
ServerName ds-admin-ms
ServerAlias ds-admin-ms
<Directory "c:/xampp/htdocs/ds-admin-ms/public">
Order allow,deny
Allow from all

Next step go to


Open this file -> hosts

Simply copy below code 👇 		ds-admin-ms

Paste here in C:\Windows\System32\drivers\etc and open this file 👉 hosts

Lets go to xampp and start run

and go to folder -> C:\xampp\htdocs\ds-admin-ms

and open terminal and run

php artisan serve

Next go to browser and paste this


Tagged : / / /

How to setup mailtrap in laravel.

Everyone who is developing an application needs to test it with emails. These emails which we test can be a real heactic task if we use the real email ids. we will have to create or ask different persons for their emails and work on it. This is a real heactic task.

To sort out this problem there a great solution that we can use. its

What is Mailtrap?

Mailtrap is a fake SMTP server to test, view and share emails sent from the development and staging environments. Mailtrap provides dummy email veryfications once we have set it up for the application. All emails sent to Mailtrap are held in the Mailtrap inbox.

How to setup Mailtrap.

There is very simple steps to set it up. we just need to follow the following steps.

  1. We first have to create an account, for this we need to visit we will see an interface as
mailtrap signup
  1. Then we need to click on signup button to signup either through your Google account, GitHub account or by providing your email address and password. we will see interface as
mailtrap signup with account
  1. Soon after the signup we will see interface like thatNow we are ready to go.

Tagged : / / / / /

How to fix PHP fatal error in Laravel? Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes)

Whenever we type the below displayed command

locobucci error

We see the command runs initially good but there comes some problem in few moments. similar to

php fatal error

This error is PHP fatal error: and complete display image is

fatal error complete image

What we need to do to remove this ?

Folllow the below steps:

  1. Close the xampp if its running.
  2. got to “C:\ProgramData\ComposerSetup\bin” (we can copy the location and paste it in the explorer header)
explorer heading

just press on the above header (after pc) and paste the location and press enter

composer setup/bin location

This will open the file location:

3. We then need to open the composer.bat to edit it (right click on it and click on edit with notepad++)

4. Now just copy the below code and replace it with the code present in composer.bat


@echo OFF
:: in case DelayedExpansion is on and a path contains ! 
php -d memory_limit=-1 "%~dp0composer.phar" %*

5. Now save it. For saving it

  • Press (Ctrl + S)
  • we will be prompted as run as Administrator.
  • press Allow
  • Then again Press ( Ctrl + S)
  • The file will be saved.

Now we can run the above command and check it.

we will see the command execuites sucessfully

Happy Coding!

Tagged : / / / / / / /

How to fix oauth private key does not exist problem in Laravel?

If we get error as Auth private key does not exist on the browser when we run any laravel project .

Something similar to

privet auth key not found

Then we just need to install the passport and do the changes to the places where needed.

Command to install Passport:

php artisan passport:install

Soon after the passport is install we will get the following things:

  1. Client id
  2. Client secret
client id and client secret

We need to put client id in the in env files where required.

Somewhat similar to given below:

placing client id and secret

We need to change the client id and client secret to all the places where the concern configuration are used.

Few important links for reference :

  1. Setup laravel project and understand folder structure click here.
  2. Crud operation and detailed explaination. click here.

Tagged : / / / /

How to fix vendor directory not present ?

whenever we run the artisan command to migrate the control looks for the vendor directory and some files inside it. thus if the vendor directory is not present, the command will not get execuited and we will get error.

The error which we see looks like :-

vendor directory not present

To overcome this error we need to update the composer thus we need to write

composer update 

This would download and update the composer and all the packages and files inside it.

The updated pages will look like:

The complete packages which will be downloaded and updated are listed below.

PS C:\xampp\htdocs\mhn-doctors-ms> composer update 
Loading composer repositories with package information
Warning from You are using an outdated version of Composer. Composer 2 is now available and you should upgrade. See
Updating dependencies (including require-dev)
Package operations: 96 installs, 0 updates, 0 removals
  - Installing kylekatarnls/update-helper (1.2.1): Loading from cache
  - Installing symfony/thanks (v1.2.10): Loading from cache
  - Installing symfony/finder (v3.4.47): Loading from cache
  - Installing psr/log (1.1.3): Loading from cache
  - Installing symfony/debug (v3.4.47): Loading from cache
  - Installing symfony/polyfill-ctype (v1.22.1): Loading from cache
  - Installing vlucas/phpdotenv (v2.6.7): Loading from cache
  - Installing symfony/css-selector (v5.2.4): Loading from cache
  - Installing tijsverkoyen/css-to-inline-styles (2.2.3): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.22.1): Loading from cache
  - Installing symfony/var-dumper (v3.4.47): Loading from cache
  - Installing symfony/routing (v3.4.47): Loading from cache
  - Installing symfony/process (v3.4.47): Loading from cache
  - Installing symfony/polyfill-php72 (v1.22.1): Loading from cache
  - Installing symfony/polyfill-intl-normalizer (v1.22.1): Loading from cache
  - Installing symfony/polyfill-intl-idn (v1.22.1): Loading from cache
  - Installing symfony/polyfill-php70 (v1.20.0)
  - Installing paragonie/random_compat (v2.0.19): Loading from cache
  - Installing symfony/http-foundation (v3.4.47): Loading from cache
  - Installing symfony/event-dispatcher-contracts (v1.1.9): Loading from cache
  - Installing psr/container (1.1.1): Loading from cache
  - Installing symfony/event-dispatcher (v4.4.20): Loading from cache
  - Installing symfony/polyfill-php56 (v1.20.0)
  - Installing symfony/http-kernel (v3.4.47): Loading from cache
  - Installing symfony/console (v3.4.47): Loading from cache
  - Installing symfony/polyfill-iconv (v1.22.1): Loading from cache
  - Installing doctrine/lexer (1.2.1): Loading from cache
  - Installing egulias/email-validator (3.1.1): Downloading (100%)
  - Installing swiftmailer/swiftmailer (v6.2.7): Loading from cache
  - Installing ramsey/uuid (3.9.3): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing symfony/translation-contracts (v1.1.10): Loading from cache
  - Installing symfony/translation (v4.3.11): Loading from cache
  - Installing nesbot/carbon (1.39.1): Loading from cache
  - Installing mtdowling/cron-expression (v1.2.3): Loading from cache
  - Installing monolog/monolog (1.26.0): Loading from cache
  - Installing league/mime-type-detection (1.7.0): Loading from cache
  - Installing league/flysystem (1.1.3): Loading from cache
  - Installing erusev/parsedown (1.7.4): Loading from cache
  - Installing doctrine/inflector (1.4.3): Loading from cache
  - Installing laravel/framework (v5.5.50): Loading from cache
  - Installing maximebf/debugbar (v1.16.5): Loading from cache
  - Installing barryvdh/laravel-debugbar (v3.4.2): Loading from cache
  - Installing fideloper/proxy (3.3.4): Loading from cache
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing zendframework/zend-diactoros (1.8.7): Loading from cache
  - Installing symfony/psr-http-message-bridge (v1.2.0): Loading from cache
  - Installing phpseclib/phpseclib (2.0.31): Downloading (100%)
  - Installing defuse/php-encryption (v2.3.1): Downloading (100%)
  - Installing lcobucci/jwt (3.4.5): Loading from cache
  - Installing league/event (2.2.0): Loading from cache
  - Installing league/oauth2-server (6.1.1): Loading from cache
  - Installing ralouphie/getallheaders (3.0.3): Loading from cache
  - Installing guzzlehttp/psr7 (1.8.1): Loading from cache
  - Installing guzzlehttp/promises (1.4.1): Loading from cache
  - Installing guzzlehttp/guzzle (6.5.5): Loading from cache
  - Installing firebase/php-jwt (v5.2.1): Loading from cache
  - Installing laravel/passport (v4.0.3): Loading from cache
  - Installing jakub-onderka/php-console-color (v0.2): Loading from cache
  - Installing jakub-onderka/php-console-highlighter (v0.4): Loading from cache
  - Installing nikic/php-parser (v4.10.4): Loading from cache
  - Installing dnoegel/php-xdg-base-dir (v0.1.1): Loading from cache
  - Installing psy/psysh (v0.9.12): Loading from cache
  - Installing laravel/tinker (v1.0.10): Loading from cache
  - Installing filp/whoops (2.12.0): Downloading (100%)
  - Installing fzaninotto/faker (v1.9.2): Loading from cache
  - Installing hamcrest/hamcrest-php (v2.0.1): Loading from cache
  - Installing mockery/mockery (1.3.4): Loading from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/resource-operations (1.0.0): Loading from cache
  - Installing sebastian/recursion-context (3.0.1): Loading from cache
  - Installing sebastian/object-reflector (1.1.2): Loading from cache
  - Installing sebastian/object-enumerator (3.0.4): Loading from cache
  - Installing sebastian/global-state (2.0.0): Loading from cache
  - Installing sebastian/exporter (3.1.3): Loading from cache
  - Installing sebastian/environment (3.1.0): Loading from cache
  - Installing sebastian/diff (2.0.1): Loading from cache
  - Installing sebastian/comparator (2.1.3): Loading from cache
  - Installing doctrine/instantiator (1.4.0): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/phpunit-mock-objects (5.0.10): Loading from cache
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing phpunit/php-file-iterator (1.4.5): Loading from cache
  - Installing theseer/tokenizer (1.2.0): Loading from cache
  - Installing sebastian/code-unit-reverse-lookup (1.0.2): Loading from cache
  - Installing phpunit/php-token-stream (2.0.2): Loading from cache
  - Installing phpunit/php-code-coverage (5.3.2): Loading from cache
  - Installing webmozart/assert (1.10.0): Loading from cache
  - Installing phpdocumentor/reflection-common (2.2.0): Loading from cache
  - Installing phpdocumentor/type-resolver (1.4.0): Loading from cache
  - Installing phpdocumentor/reflection-docblock (5.2.2): Loading from cache
  - Installing phpspec/prophecy (v1.10.3): Loading from cache
  - Installing phar-io/version (1.0.1): Loading from cache
  - Installing phar-io/manifest (1.0.1): Loading from cache
  - Installing myclabs/deep-copy (1.10.2): Loading from cache
  - Installing phpunit/phpunit (6.5.14): Loading from cache
symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)
symfony/var-dumper suggests installing ext-symfony_debug
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/yaml (For using the YAML loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
symfony/polyfill-intl-normalizer suggests installing ext-intl (For best performance)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.) 
symfony/event-dispatcher-contracts suggests installing psr/event-dispatcher
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/http-kernel suggests installing symfony/browser-kit
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/dependency-injection
symfony/console suggests installing symfony/lock
egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation)
swiftmailer/swiftmailer suggests installing ext-intl (Needed to support internationalized email addresses)
ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator)        
ramsey/uuid suggests installing ext-uuid (Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator)
ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).)
ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid)
ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.)
ramsey/uuid suggests installing paragonie/random-lib (Provides RandomLib for use with the RandomLibAdapter)
symfony/translation suggests installing symfony/config
symfony/translation suggests installing symfony/yaml
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)        
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)       
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
laravel/framework suggests installing ext-pcntl (Required to use all features of the queue worker.)
laravel/framework suggests installing ext-posix (Required to use all features of the queue worker.)
laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (~3.0).)
laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (~2.5).)
laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (~1.0).)
laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
laravel/framework suggests installing league/flysystem-cached-adapter (Required to use Flysystem caching (~1.0).)
laravel/framework suggests installing nexmo/client (Required to use the Nexmo transport (~1.0).)
laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (~3.0).)
laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (~1.0).)
laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (~3.0).)
laravel/framework suggests installing symfony/dom-crawler (Required to use most of the crawler integration testing tools (~3.3).)   
maximebf/debugbar suggests installing kriswallsmith/assetic (The best way to manage assets)
maximebf/debugbar suggests installing predis/predis (Redis storage)
symfony/psr-http-message-bridge suggests installing nyholm/psr7 (For a super lightweight PSR-7/17 implementation)
phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.)
phpseclib/phpseclib suggests installing ext-mcrypt (Install the Mcrypt extension in order to speed up a few other cryptographic operations.)
phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.)
lcobucci/jwt suggests installing lcobucci/clock (*)
guzzlehttp/psr7 suggests installing laminas/laminas-httphandlerrunner (Emit PSR-7 responses)
psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))
psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already 
support readline or libedit.)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use laminas/laminas-diactoros instead.
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.   
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating optimized autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
    You can run ".\vendor\bin\upgrade-carbon" to get help in updating carbon and other frameworks and libraries that depend on it.  
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.
42 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Tagged : / / / /

Class ‘App\Http\Controllers\Student’ not found

In this tutorial I’m going to describe how to solve “Class ‘App\Http\Controllers\Student’ not found” if you got this types of error please follow some easy steps

1step this types of error is showing when you’re not using class name whatever you have define below code as like :-

public function index()
$students = Student::all();

return view(‘students.dashboard’,compact(‘student’));

2nd you have to add your model name above of the StudenController class name

3rd step got your Controller :- StudentController.php

And add model name in the Student Controller class here as like this

use App\Student;

Then refresh your browser and you got solve your errors.

Thanks hopefully it will helpful for you. 👍👍

Tagged : / / / /

How to create virtual local host setup in Laravel

In this tutorial I’m going to describe how to set up virtual host in Laravel. Please follow this Tutorial and you able to create successfully virtual host in Laravel

1. Go to C drive and Go to this Directory-> C:\xampp\apache\conf\extra and open httpd-vhosts name of folder


Open this folder -> httpd-vhosts

2nd Step Copy Below Code


<VirtualHost *:80>

DocumentRoot “C:/xampp/htdocs/blog/public”

ServerName localhost


<VirtualHost *:80>

DocumentRoot “C:/xampp/htdocs/blog/public”




and paste simply there in this folder -> httpd-vhosts

3rd Step go to windows C:\Windows\System32\drivers\etc and open hosts folder

4th step simply copy this

👇 localhost

And paste this folder


After stop your xampp apache server and start then

And start then Xampp Apache server

And run now you can see localhost set up is done.

Thanks …… 🙂

Tagged : / / / /