Laravel 5 Generate App Key

Source code: https://github.com/connor11528/laravel-5-fundamentals
Twitter: https://twitter.com/Connor11528

Application Key. The next thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command. Typically, this string should be 32 characters long. You are now almost ready to deploy the application. Follow the next section to ensure your Laravel app runs with the correct configuration. Setting a Laravel encryption key. The application’s encryption key is used by Laravel to encrypt user sessions and other information. Its value will be read from the APPKEY environment variable.

If you enjoy this post give the repo a star or the article a share!

I began messing with Vue.js for the frontend. After watching the awesome Vue.js Laracasts series I decided to jump into full stack development with PHP and Laravel. The Laravel 5 Fundamentals series is very accessible and walks us through application development in this PHP Framework. This post covers the first half of the course content.

Laravel 5 tutorial pdf

If you have issues getting Laravel or its dependencies installed, create a github issue here and we will try to help!

We'll assume you have installed PHP >= 5.4, MySQL, Composer and a few extensions (install docs). We are using version 5.0 which was release in early 2015. The framework has a set release timetable and is up to version 5.3. The 5.3 features are incredible. In this post we will cover Laravel Fundamentals using 5.0.

This will launch a web server in your browser. You can view it on localhost:8000.

Laravel follows the MVC pattern like other web frameworks. If you come from Rails or Django background this should be very familiar!

This will generate app/Http/Controllers/PagesController. Controllers are matched to routes.

List all routes for our application:
php artisan route:list

Blade is the front end templating language for Laravel. Use it within your HTML to pass variables from the server to the markup. In the 5.3 release Laravel ships automatically with Vue.js and makes it easy to switch it up with other JS web frameworks -- if you're into that type of thing.

App

Blade control structures docs

Laravel 5 Tutorial Pdf

Set 'pretend' => true, in config/mail.php so that emails get written to a log file instead of sent over the web. This is easier for local development.

Check through all the files in the config directory. They are very easy to read and very thoroughly documented. Fun fact: every line comment in article is three characters shorter than the previous line.

Changing database schema in production

In production we cannot simply rollback the database to change schema.

Instead, create a new migration

In order to drop a table requires doctrine/dbal package. Install it with composer: composer require doctrine/dbal.

Create Database Table

Create a articles table and migration.

Changing Database Schema

To change a schema, use the rollback command, make the changes in database/migrations to the appropriate file and then run php artisan migrate

View database records

After running the above sqlite command we can use SQL to query our database.

Eloquent is Laravel's ActiveRecord implementation. This means that it is the ORM wrapper allowing you to write PHP code that generates SQL statements. We define Eloquent Models that model our database. Eloquent docs

In order to catch 404 page errors we can modify app/Exceptions/Handler.php. The error page template is stored in resources/views/errors/404.blade.php.

If we have a view file accessible at “errors.{errorStatusCode}”, it’ll automatically display for that status code (5.0 custom error pages).

Images are stored in the ./public folder.

Form builder and HTML builder are removed from the core framework.

They can be installed via:

Laravel 5 Generate App Key In Laravel

Illuminate/html github repo.

Note, the above is specific to Laravel 5.0. If using Laravel >=5.3 use composer require 'laravelcollective/html':'^5.3.0'. More information is on the Laravel Collective website.

Generates file in app/Http/Requests/.

Laravel Key Generate

View Form errors in html view: <pre>{{ var_dump($errors) }}</pre>

Laravel App Class

That about covers it for the first half of the Laravel 5 Fundamentals course on Laracasts. I highly recommend it so far! In the next half we will cover Eloquent Database Relationships, Authentication and more advanced features of Laravel 5.0!

Source code: https://github.com/connor11528/laravel-5-fundamentals
Twitter: https://twitter.com/Connor11528

Laravel 5.8

If you enjoy this post give the repo a star or the article a share!