Friday, October 27, 2017

how to change laravel login and registration view

1st go to web.php you can see auth routing . Here  route is method and this is special routing
where define this routes?
\vendor\laravel\framework\src\Illuminate\Routing\Router.php

You can see a class Router. On this class routes method is available 
You can see a Auth function 

we know that there are 3 rules of routing:
1) url, 
2) URL::to
3) route

on this function you can see how define URL with route  

SO for login page 

showLoginForm function is working.  
But after checking loginController we can't see showLoginForm fucntion. 

You can see AuthenticatesUsers this is not a method and this not a function this is a trait 
see on this AuthenticatesUsers we can see this function. 

Now you can  understand where is view file go to recourse> auth> login.blade.php 







How to connect mysql database with laravel

1st to go phpmyadmin
2nd create a database. and go to .evn file, find DB_CONNECTION=mysql line and add database name that you have created on phpmyadmin
3rd user will be root for homeserver

password will be blank like 
DB_DATABASE=your_database_name
DB_USERNAME=root
DB_PASSWORD=


connection is completed.

How i will create a table on laravel database:
go to database >migration 

you can see 2 files 

enter on those file and on those file you can see 3 classes . 1st one is Schema

when we create table we will must use Schema file that's the process on laravel 

there are 2 functions one is up and another is down. with up class table is created and with down function table is dropped 

Which function define with type of table column : go to https://laravel.com/docs/5.5/migrations

you can see Available Column Types table 


How to run Schema file  extrude on server  :
open terminal and write php artisan migrate 



but we can catch an error and exception. 
solve: 
this cause from 5.3 laravel 
when you will make any column unique or index then the total column size must be between 767 bytes 




now you will not get any error and exception. 
see

Thank You.


Auth class installation

1st check where will be add new file after install auth class
controller,  resource> views and routes > web.php 

open terminal:

php artisan make:auth
 make sure

3 new file change after installing auth class: 
controller: homeController.php
view: home.blade.php, layout and auth
routes: web.php
Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');


In project we will get access now public/login and public/register url 

Laravel Normal Template / Theme Mastering

1st go to recourse > views and create directory one is front and 2nd is admin
2nd on front folder create on directory home and a php file master.blade.php
3rd copy all code of your template index.html and past on master.blade.php
4th go to routes >web.php and check the root. make get and load a view at /  with a controller and function


5th on home directory create a file home-content.blade.php
on  home-content.blade.php
@extends('front.master')

Title dynamic:
@section('title')    RAN - IT
    @endsection

and master.blade.php 
@yield('title')

==================================
How to get style and images

go to public create 2 directory one is front and another admin
and past all css, images, js file on front folder. 

sec dynamic:
{{asset('/front/')}} before /in front folder or file.
=====================================
for href dynamic:
{{url('/')}} root directory


another way 
{{URL::to('/')}} Here URL is class

another way:
{{route('/')}}

=================================
for fix section:
we will create a folder name includes on front folder

and all commerce section will go on here like header, sidebar etc. 
then we will use @include and i will not use @yield and @section

We will just past the html code on header , footer sidebar etc.

Thank You.










Thursday, October 26, 2017

Install Laravel

1st : we have to chick composer is available on my PC  yes or not.

How to install a composer: 
1st composer is a Dependency Manager for PHP.
go to getcomposer.org > click on download > download Composer-Setup.exe  file. 

Installation process: 
Run this exe file and select a proper path
path will be php.exe file what you can find it on your homeserver php folder> php.exe.
no another configuration is required. only next next next.

How to check Composer is available on your PC or not:
open terminal and write composer 
You can see composer configuration all documents then you can sure that composer is running on your pc. 

Install laravel:
go to htdocs and open terminal and write composer create-project laravel/laravel your-project-name
(please don't create a folder on htdocs) you have install laravel only htdocs folder 
check this one and go to your project name folder you can see public folder run on your browser through localhost you can see laravel page 


That's it.

Thank You.