How to Build a Blog with Laravel

How to Build a Blog with Laravel




CLASS Daily 1 Hour

Weekend No Class But available for solving issues


- Laravel API

- Laravel Payment Method (2checkout/stripe)

- basics of laravel

- Laravel CRUD

- Laravel Workflow


Prerequisite Technologies


  • Core PHP

  • Basics knowledge of programming (variable, condition, loops etc)


CLASS : 1


Video Class :


Installation 


Step 1 − Install xampp

Step 2 − Download and install composer from here https://getcomposer.org/download/

Step 3 − Verify Composer, open cmd and write composer it will show version of composer

Step 4 − go to xampp root folder (C:/xampp/htdocs/) 

Step 5 - run following command in cmd: composer create-project --prefer-dist laravel/laravel 

blog

Step 6 - go to project folder (C:/xampp/htdocs/blog) 

Step 7 - run following command in cmd: php artisan serve 

Step 7 - open browser and run http://localhost:8000 your first laravel project is up and running


Configuration

- setup .env file

- Generate application key

Run following command and generate application key

php artisan key:generate


Routes

- Route::get('/user', 'UserController@index');


- Route::post('/user', 'UserController@index');


- Route::match(['get', 'post'], '/', function () {

    //

});



- Route::any('/', function () {

    //

});



Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {

    //

});


Route::prefix('admin')->group(function () {

    Route::get('users', function () {

        // Matches The "/admin/users" URL

    });

});



CLASS : 2


Video Class:




Controller

  • php  artisan make:controller PagesController

  • php artisan make:controller PagesController --resource 


Create some pages to understand view

Create controller run that view from there


View (Blade system)

  • Install vs code extension: laravel blade snippets

  • Create layout and extend with content

  • @yield(‘content’)

  • @extends(‘layout.app’)

@section(‘content’)

Your Content

@endsection

  • Passing values to view

    • $text = ‘welcome’;

    • view(‘pages.about’,compact(‘text’));

or

    • view(‘pages.about’)->with(‘text’,’welcome’);

    • {{$text}}

  • ADD ASSETS FILE IN YOUR VIEW

    • Put file in public folder

    • Add file in to your view using {{asset(‘css/app.css’)}}



CLASS 3


Video Class:




Parse values to views

//to get all list of routes

php artisan route:list

//link

http://localhost/phpmyadmin


MIGRATION & DATABASES:

To create model

php artisan make:model ModelName -m

*-m for create its migration as well


Migration

It will create a class in migration folder

It has 2 functions UP and DOWN

On running migration it will run UP function


You can add more fields in UP functions as per your need.

Then run 

php artisan migrate




Requests

Migration

Model 


Form

Validation 




Post a Comment

0 Comments