Showing posts with label Laravel. Show all posts
Showing posts with label Laravel. Show all posts

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 

Sunday, October 1, 2017

Laravel Project One

Requirements:
Php version up to 7.
Now we are using xampp home server. I will prefer Editor: PhpStorm for only Php. If you want where you want to want this software, for that you can knock me on this post comment i will give a link.
Installation: 
cmd:| composer create-project laravel/laravel project-one 

All framework will work as a MVC pattern: (Model, View, Controller).


Folder: 

1) app: 

1) all configuration file
2) Control class file, Model Class file
Controller class:::


All controller class will be available on this file. It's call controller class.
Controller will be work with view.


Model class:::

This is model class. Model will be work with database.



 2) Bootstrap:

For design



3) Config
all configuration file will be here. We will use app.php






4) database:

when we will create table on database then for every table we will create individual migration file.
see one migration file:
 



 5) public:
index.php main file for enter framework. all css, js and images will be here



6) resource:
all view file will be here



7) storage:
how Line by line debug  is happening all information is here.



8) tests:
project unit test purpose 



9)vendor:
all library file from collected different framework 



10) .env
all configuration add on this file like mail creation, database etc. 



11) composer.json:
 project description . Composer can find our project by this file. 



12) phpunit.xml:
project will be auto load by this file. No need required file

===============================================
.blade.php this file is comes from symphony . for .blade file will be more secured 

this file control the rote by function
 


and those are views file