Laravel Admin Template

  • Upload
    laravel

  • View
    232

  • Download
    1

Embed Size (px)

Citation preview

  • 7/23/2019 Laravel Admin Template

    1/35

    What is Laravel?

    Laravel is an open source MVC PHP Frameworkunder MIT License

  • 7/23/2019 Laravel Admin Template

    2/35

    MVC Architecture Model Model deals with !ackend lo"ical

    structure o# the application such as data !aserecords$ In laravel it is denoted as %lo&uentmodel$

    View View deals with #rontend such as theHTML' C(($ In laravel it works with )ladeTemplate %n"ine and denoted as View$

    Controller Model and View can !ecommunicated throu"h Controllers$ In laravel it isdenoted as Controller$

  • 7/23/2019 Laravel Admin Template

    3/35

    MVC Architecture

  • 7/23/2019 Laravel Admin Template

    4/35

    Installin" LaravelRequirements:The Laravel #ramework has a #ew s*stem

    re&uirements$

    PHP version should !e +$+$, or "reater Apache or an* other compati!le we! server -atata!ase like M*(.L Composer dependenc* mana"er I-% Tool (uch as PHP (torm or An* %ditor like

    (u!lim Te/t' 0otepad11$

  • 7/23/2019 Laravel Admin Template

    5/35

    Installin" Laravel In Linu/ Apache' M*(.L 2 PHP can !e

    installed throu"h terminal

    3 apt4"et install php+4common li!apache54

    mod4php+ php+4cli php+4m*s&l php+4curl

  • 7/23/2019 Laravel Admin Template

    6/35

    Installin" Laravel To Check PHP

    use php 4v at terminal to check PHP version

    Or else use localhost to check php information

  • 7/23/2019 Laravel Admin Template

    7/35

    Installin" Laravel

  • 7/23/2019 Laravel Admin Template

    8/35

    Installin" Laravel Laravel utili6es Composer to mana"e its

    dependencies$ To install composer throu"hterminal

    3 curl 4s( https77"etcomposer$or"7installer 8php

    3 mv composer$phar 7usr7local7!in7composer

    3 composer "lo!al re&uire

    9laravel7installer:;

  • 7/23/2019 Laravel Admin Template

    9/35

    Installin" Laravel

  • 7/23/2019 Laravel Admin Template

    10/35

    Installin" Laravel To check Composer

  • 7/23/2019 Laravel Admin Template

    11/35

    Create Laravel App To Create Laravel Application throu"h

    terminal

    3 composer create4pro=ect laravel7laravel

    name4o#4the4app

  • 7/23/2019 Laravel Admin Template

    12/35

    Create Laravel App )rowse to the #ollowin" >L in *our we!

    !rowser$

    http77localhost7pro=ect4name7pu!lic7

  • 7/23/2019 Laravel Admin Template

    13/35

    Laravel director* structure A#ter cratin" laravel @rst app *ou will notice

    there is hu"e laravel director* structure

  • 7/23/2019 Laravel Admin Template

    14/35

    Laravel director*

    structure Let us discuss the director* structure in !rie# It comes as no surprise that all Laravel pro=ects have

    essentiall* the same director* structure 4 one in whichever* @le has its desi"nated place$ )* "entl* #orcin" thisdirector* structure upon developers' Laravel ensures that

    *our work is semi4automaticall* or"ani6ed the Laravelwa*B$

    As *ou can see' this standard director* structure consistso# &uite a #ew su!directories$ This wealth o# su!directoriescan !e overwhelmin" at @rst' !ut well e/plore them one

    !* one$ Most o# *our work will happen in the app7 #older'!ut heres a !asic rundown on the #unction o# each o# the@les and #olders

  • 7/23/2019 Laravel Admin Template

    15/35

    Laravel director*

    structure Top4level Folders and their purpose 7app7 Contains the controllers' models' views and assets #or*our application$ This is where the ma=orit* o# the code #or*our application will live$ Dou will !e spendin" most o# *ourtime in this #olderE

    7pu!lic7 The onl* #older seen to the world as4is$ This is thedirector* that *ou have to point *our we! server to$ Itcontains the !ootstrap @le inde/$php which =ump4starts theLaravel #ramework core$ The pu!lic director* can also !eused to hold an* pu!licl* accessi!le static assets such asC((' avascript @les' ima"es and other @les$

    7vendor7 A place #or all third4part* code$ In a t*pical Laravelapplication' this includes the Laravel source code and itsdependencies' and plu"ins containin" additionalprepacka"ed #unctionalit*$

  • 7/23/2019 Laravel Admin Template

    16/35

    Laravel director*

    structure 7app7Http7routes$php (uppose routes$php @le contains the !elow

    mentioned code oute"etG7' #unctionG

    J return viewGwelcomeKK When *ou !rowse

    http77localhost7pro=ect4name7pu!lic7

    It "oes to routes$php and @nds "et re&uest and as aresult it "oes to return viewGwelcome$ (o it thenmoves to view director*$

    http://localhost/project-name/public/http://localhost/project-name/public/
  • 7/23/2019 Laravel Admin Template

    17/35

    Laravel director*

    structure 7resources7views7welcome$!lade$php )lade is the simple' *et power#ul

    templatin" en"ine provided withLaravel$The complete user viewa!le

    contents can !e placed here It uses html' css'=avascript and php

  • 7/23/2019 Laravel Admin Template

    18/35

    Laravel director*

    structure (uppose routes$php has the !elow code outeresourceGphoto' PhotoControllerK It "oes to App7Http7Controllers7 director* and

    @nds PhotoController$php which containslo"ic #or !ackend data$

    This sin"le route declaration creates multipleroutes to handle a variet* o# %(T#ul actions

    on the photo resource$

  • 7/23/2019 Laravel Admin Template

    19/35

    Laravel director*

    structure Methods or Actions Handled )* esource Controller Ver! Path Action oute 0ame %T 7photo inde/ photo$inde/ %T 7photo7create create photo$create

    PN(T 7photo store photo$store %T 7photo7Jphoto show photo$show %T 7photo7Jphoto7editedit photo$edit P>T7PATCH 7photo7Jphoto update photo$update -%L%T% 7photo7Jphoto destro* photo$destro*

  • 7/23/2019 Laravel Admin Template

    20/35

    Laravel director*

    structure

    PhotoController$php class PhotoController e/tends ControllerJ pu!lic #unction inde/G J

    return viewGwelcomeK pu!lic #unction createGJ 77lo"ic #or create photo pu!lic #unction storeGJ 77lo"ic #or store photo pu!lic #unction showGJ 77lo"ic #or show photopu!lic #unction editGJ 77lo"ic #or edit photo

    pu!lic #unction updateGJ 77lo"ic #or update photo pu!lic #unction destro*GJ 77lo"ic #or destro* photo

  • 7/23/2019 Laravel Admin Template

    21/35

    osh4 An %/ample Laravel

    AppWant to !e more #amiliar with Laravel ?Dou can "o #or osh which is an e/cellent admin

    template #or Laravel #ramework$

    This template made with rich #eatures esponsive clean desi"n >ser #riendl* Laravel HTML+

    C((O )ootstrap O$O$

  • 7/23/2019 Laravel Admin Template

    22/35

    osh4 Installation osh doesnt ship with whole laravel @les' so *ou

    need to intall laravel @rst$ install laravel usin" composer !* e/ecutin" 3 composer

    create4pro=ect laravel7laravel *ourQpro=ectQname

    0e/t setup -ata!ase Laravel + ships with $env @le$ Incase' *ou dont @nd it in root #older o# *our laravel

    installation' e/ecute #ollowin" command in terminal to make it$

    cp $env$e/ample $env then edit data!ase' environment related details in that

    @le$

  • 7/23/2019 Laravel Admin Template

    23/35

    osh4 Installation-irector* Permissions

    Laravel +$< re&uires directories within thestora"e and the !ootstrap7cache directories

    should !e writa!le !* *our we! serverTodo this run the !elow commands on

    terminal

    3 chmod 4 RR+ stora"e

    3 chmod RR+ !ootstrap7cache

  • 7/23/2019 Laravel Admin Template

    24/35

    osh4 InstallationMail (etup

    Laravel +$< stored all mail in#ormation in $envso setup details in $env

    (till *ou need to set sender name and emaildetails in con@"7mail$php

    I# *ou are testin" locall* or dont want to sendan* mails' then please set pretend :S true'

    in con@"7mail$php at !ottom o# the pa"e$

  • 7/23/2019 Laravel Admin Template

    25/35

    osh4 Installation

    Cop*in" osh @les now cop* @les downloaded #rom

    http77codecan*on$net7item7=osh4laravel4admin4template4#ront4end4crud7R++5to *our laravel +$< installation$

    updatin" autoload composer should know some new @les were

    added so that it can autoload them

    Hit 3 composer dump4autoload in terminal #orthat

    http://codecanyon.net/item/josh-laravel-admin-template-front-end-crud/8754542http://codecanyon.net/item/josh-laravel-admin-template-front-end-crud/8754542http://codecanyon.net/item/josh-laravel-admin-template-front-end-crud/8754542http://codecanyon.net/item/josh-laravel-admin-template-front-end-crud/8754542
  • 7/23/2019 Laravel Admin Template

    26/35

    osh4 Installation-elete e/istin" mi"ration @les

    (ince we are not rel*in" on de#ault mi"rationta!les' please remove #ollowin" two @les #rom

    data!ase7mi"rations #older 5U

  • 7/23/2019 Laravel Admin Template

    27/35

    osh4 Installation Install Packa"es We use "ood num!er o# packa"es to provide

    "reat #unctionalit* without re4inventin" wheel$ 0ow add !elow mentioned packa"es in

    composer$=son in re&uire arra*

    9cartal*st7sentinel9 95$U$9' 9laravelcollective7html9 9+$

  • 7/23/2019 Laravel Admin Template

    28/35

    osh4 InstallationAdd service providers

    Npen con@"7app$php and add #ollowin" lines in theproviders arra*

    Cartal*st(entinelLaravel(entinel(erviceProviderclass'

    CollectiveHtmlHtml(erviceProviderclass'

    Cvie!rock%lo&uent(lu""a!le(lu""a!le(erviceProviderclass'

    Cvie!rock%lo&uentTa""a!le(erviceProviderclass'

    *a=ra-atata!les-atata!les(erviceProviderclass

  • 7/23/2019 Laravel Admin Template

    29/35

    osh4 InstallationIn the 3aliases arra* add #ollowin" #acades

    Activation :SCartal*st(entinelLaravelFacadesActivationclass'

    eminder :SCartal*st(entinelLaravelFacadeseminderclass'

    (entinel :SCartal*st(entinelLaravelFacades(entinelclass'

    Form :S CollectiveHtmlFormFacadeclass'Html :S CollectiveHtmlHtmlFacadeclass'

    -atata!les :S *a=ra-atata!les-atata!lesclass'

  • 7/23/2019 Laravel Admin Template

    30/35

    osh4 Installationpu!lish vendors

    now we need to pu!lish vendor @les so that the*will pu!lish con@" @les' mi"rations$

    %/cecute #ollowin" command in commandprompt7terminal

    3 php artisan slu""a!leta!le !lo"s3 php artisan ta""a!leta!le

    3 php artisan vendorpu!lish

    0ow we need to add user' "roups etc ta!les to

    data!ase' to do so in *our command prompt'e/ecute #ollowin" code3 php artisan mi"rate

    0ote please check all @les in data!asemi"rationsto know what @elds are !ein" added$

  • 7/23/2019 Laravel Admin Template

    31/35

    osh4 Installationsettin" up con@" to use our modelsince we have diXerent re&uirements Ge/tra

    @elds in users ta!le' we need to chan"e sentinelcon@" to use our user Model'

    to do that open con@"7cartal*st$sentinel$phpat line +Y' @nd

    model :SCartal*st(entinel>sers%lo&uent>ser'

    replace it withmodel :S App>ser'

  • 7/23/2019 Laravel Admin Template

    32/35

    osh4 InstallationAdd admin user As data!ase ta!les have !een setup' we need to

    add admin user to !e a!le to lo"in into adminCP$ un #ollowin" command in *our command

    prompt

    3 php artisan d!seed 44class:Admin(eeder

    A de#ault admin user with user with usernameadminZadmin$com and password admin will !ecreated

  • 7/23/2019 Laravel Admin Template

    33/35

    osh4 Installationusers pro@le pics will !e uploaded into

    pu!lic7uploads7users

    (o we need to provide write access #or that#older

    to do so' please run #ollowin" command in*our command prompt7terminal

    3 chmod RR+ pu!lic7uploads7users

    3 chmod RR+ pu!lic7uploads7!lo"Finall*'

    )rowse to http77localhost7=oshQlaravel+

  • 7/23/2019 Laravel Admin Template

    34/35

    o with osh

    Congratulations! You are ready to rock the world!!

  • 7/23/2019 Laravel Admin Template

    35/35

    For More Info Contact Us:www.oshadmin.com

    For More In#o Visit www$=oshadmin$com

    shadmin.com