Creating a Basic Laravel MVC Application

Laravel applications follow the traditional Model-View-Controller design pattern, where you use: Controllers to handle user requests and retrieve data, by leveraging Models Models to interact with your database and retrieve your objects’ information Views to render pages Additionally, routes are used to map URLs to designated controller actions, as shown below. The full MVC request cycle in a Laravel 5 application So… A request is made — say, when a Read more…

Laravel DB – All in One

Installing and Creating a Laravel 5.8 Project In this section we’ll introduce Laravel and then proceed it to install and create a Laravel 5.8 project. About Laravel Laravel docs describe it as: Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used Read more…

Laravel Forms

Laravel Forms has been removed from laravel 5.x. we can use laravelcollective instead: Installation Begin by installing this package through Composer. Edit your project’s composer.json file to require laravelcollective/html. Next, add your new provider to the providers array of config/app.php: Finally, add two class aliases to the aliases array of config/app.php: Looking to install this package in Lumen? First of all, making this package compatible with Lumen will require some Read more…

Laravel – All in One

Laravel 5.7 CRUD Example Tutorial First, let us install Laravel 5.7 using the following command. We will use Composer Create-Project to generate laravel 5.7 projects.Earn a Tech Degree and get the skills like Frontend Development or Javascript Development that can help you to launch a career. Start your free trial #1: Install Laravel 5.7 Type the following command. Make sure you have installed composer in your machine. Okay, now go inside the folder and install the npm packages Read more…

Query database

Migration file example Read data with Models create a new model (found models inside app directory. Start laravel playground App\Project::all(); – show all records under project table (collection of items) App\Project::first(); – show all records on the first project. $project = new App\Project; $project->title = ‘my first project’; – insert data to title column. $project->description = ‘my description’; – insert data to description column. $project; – show insert information. $project->save(); Read more…

Databases and Migrations

All tables define as a classes. Migrations migration are like version control for your database. it’s quickly define a scheme for the a table without the need to learn any language. run the migrate: php artisan migrate if tables exists (drop the tables and recreate): php artisan migrate:fresh if any errors – go to database/mirgation inside function up() add this: Schema::defaultStringLength(191); – after then fix run: php artisan migrate:fresh you Read more…

Passing Data Resources

@extends(‘layout’) – display page from resources/view/layout.blade.php @include(‘navbar’) – include the file from resources/view/navbar.blade.php @yield(‘content’) – read data from “section” @section(‘content’) – register section for contect @yield(‘content’)@endsection Use yield & section to pass data Passing page Title @section(‘title’) Welcome HomePage @endsection or you can use: @section(‘title’, ‘Welcome Homepage’) Passing Data between files Route::get(‘/’, function () { $tasks = [ ‘Go to the store’, ‘Go to the market’, ‘Go to work’ ]; Read more…

Laravel IBMi Toolkit

Laravel-ibmi is a simple DB2 & Toolkit for IBMi service provider for Laravel. It provides DB2 Connection by extending the Illuminate Database component of the laravel framework. Plus it also provides Toolkit for IBMi so that you can access IBMi resources with same credentials. Installation Add laravel-ibmi to your composer.json file: Use composer to install this package. Configuration There are two ways to configure laravel-ibmi. You can choose the most Read more…