Professional Documents
Culture Documents
Laravel Admin Template
Laravel Admin Template
MVC Architecture
MVC Architecture
Installing Laravel
Requirements:
The Laravel framework has a few system
requirements.
Installing Laravel
In Linux Apache, MySQL & PHP can be
installed through terminal
$ apt-get install php5-common libapache2mod-php5 php5-cli php5-mysql php5-curl
Installing Laravel
To Check PHP
use php -v at terminal to check PHP version
Installing Laravel
Installing Laravel
Laravel utilizes Composer to manage its
dependencies. To install composer through
terminal
$ curl -sS https://getcomposer.org/installer |
php
$ mv composer.phar /usr/local/bin/composer
$ composer global require
"laravel/installer=~1.1"
Installing Laravel
Installing Laravel
To check Composer
Laravel directory
structure
Let us discuss the directory structure in brief
Laravel directory
structure
Top-level Folders
and their purpose
/app/ Contains the controllers, models, views and assets for
your application. This is where the majority of the code for
your application will live. You will be spending most of your
time in this folder!
/public/ The only folder seen to the world as-is. This is the
directory that you have to point your web server to. It
contains the bootstrap file index.php which jump-starts the
Laravel framework core. The public directory can also be
used to hold any publicly accessible static assets such as
CSS, Javascript files, images and other files.
/vendor/ A place for all third-party code. In a typical Laravel
application, this includes the Laravel source code and its
dependencies, and plugins containing additional
prepackaged functionality.
Laravel directory
structure
/app/Http/routes.php
{
return view('welcome');
});
Laravel directory
structure
/resources/views/welcome.blade.php
Laravel directory
structure
Suppose routes.php has the below code
Route::resource('photo', 'PhotoController');
It goes to App/Http/Controllers/ directory and
finds PhotoController.php which contains
logic for backend data.
This single route declaration creates multiple
routes to handle a variety of RESTful actions
on the photo resource.
Laravel directory
structure
Laravel directory
structure
PhotoController.php
class PhotoController extends Controller
{
public function index()
{
return view('welcome');
}
public
public
public
public
public
public
}
function
function
function
function
function
function
Josh- Installation
Josh doesn't ship with whole laravel files, so you
Josh- Installation
Directory Permissions
Laravel 5.1 requires directories within the
storage and the bootstrap/cache directories
should be writable by your web server
Todo this run the below commands on
terminal
$ chmod -R 775 storage
$ chmod 775 bootstrap/cache
Josh- Installation
Mail Setup
Laravel 5.1 stored all mail information in .env
so setup details in .env
Still you need to set sender name and email
details in config/mail.php
If you are testing locally or don't want to send
any mails, then please set 'pretend' => true,
in config/mail.php at bottom of the page.
Josh- Installation
Copying Josh files
now copy files downloaded from
http://codecanyon.net/item/josh-laravel-admintemplate-front-end-crud/8754542
to your laravel 5.1 installation.
updating autoload
composer should know some new files were
Josh- Installation
Delete existing migration files
Since we are not relying on default migration
tables, please remove following two files from
database/migrations folder
2014_10_12_000000_create_users_table.ph
p
2014_10_12_100000_create_password_rese
ts_table.php
installation.
JoshInstallation
Install Packages
We use good number of packages to provide
"cartalyst/sentinel": "2.0.*",
"laravelcollective/html": "5.1.*",
"cviebrock/eloquent-sluggable": "dev-master",
"cviebrock/eloquent-taggable": "dev-master",
"yajra/laravel-datatables-oracle": "~5.0"
update vendors
Josh- Installation
Add service providers
Open config/app.php and add following lines in the
providers array
Cartalyst\Sentinel\Laravel\SentinelServiceProvider:
:class,
Collective\Html\HtmlServiceProvider::class,
Cviebrock\EloquentSluggable\SluggableServicePro
vider::class,
Cviebrock\EloquentTaggable\ServiceProvider::class
,
yajra\Datatables\DatatablesServiceProvider::class
Josh- Installation
In the $aliases array add following facades
'Activation' =>
Cartalyst\Sentinel\Laravel\Facades\Activation::class,
'Reminder' =>
Cartalyst\Sentinel\Laravel\Facades\Reminder::class,
'Sentinel'
=>
Cartalyst\Sentinel\Laravel\Facades\Sentinel::class,
'Form'
=> Collective\Html\FormFacade::class,
'Html'
=> Collective\Html\HtmlFacade::class,
'Datatables' => yajra\Datatables\Datatables::class,
Josh- Installation
publish vendors
now we need to publish vendor files so that they
will publish config files, migrations.
Excecute following command in command
prompt/terminal
$ php artisan sluggable:table blogs
$ php artisan taggable:table
$ php artisan vendor:publish
Josh- Installation
setting up config to use our model
since we have different requirements (extra
Josh- Installation
Add admin user:
Josh- Installation
user's profile pics will be uploaded into
public/uploads/users
So we need to provide write access for that
folder
to do so, please run following command in
your command prompt/terminal
$ chmod 775 public/uploads/users
$ chmod 775 public/uploads/blog
Finally,
Browse to http://localhost/josh_laravel51/public/
Go with Josh
shadmin.com