Laravel PHP Framework with AdminLTE2
Whenever I start a new Laravel project, I do the same thing; Install packages, download Javascript plugins...etc.
This repository helps me bootstrap all of that.
Note: if you want to use Laravel 5.2, 5.3, 5.4 please checkout to branch
All you need is to run these commands:
git clone https://github.com/kossa/laralte2.git
cd laralte2
composer install # Install backend dependencies
sudo chmod 777 storage/ -R # Chmod Storage
cp .env.example .env # Update database credentials configuration
php artisan key:generate # Generate new keys for Laravel
php artisan migrate:refresh --seed # Run migration and seed users and categories for testing
yarn install # Install node dependencies
npm run production # To compile assets for prod
- Online demo: Can be found at laralte2.bel4.com/admin
- Local demo:
php artisan serve # Check installation (optional)
Open browser at localhost:8000/admin
Note:
Username: [email protected]
Password: 123456
All the data are reset each 30mn ;) please d'ont forget to remove this function in your app
- Laravel Framework (5.4.*)
- Forms & HTML : for forms
- Laravel Debugbar : for debugging
- Intervention Image : image handling and manipulation
- Guzzle : PHP HTTP client
- Laravel RESTful API format : To create Rest API
- Redis : for chache
LaraLTE2 uses :
- Laravel Mix
- AdminLTE
- AdminLTE-RTL for RTL support
- ApiDocs
- Ionicons
- bootstrap
- chosen
- ckeditor Full
- datatables + plugins
- datetimepicker
- font-awesome
- jquery
- sweetalert2
- iCheck
- Axios
- VueJs
- Turbolinks
- Using Laravel Mix, all CSS and JS are in minified to one file each.
- LaraLTE2 leverages browser caching, using
.htaccess
file from html5-boilerplate - GZip compression is activated by default(APP_DEBUG=false => only onfile for js, and one file for css).
admin-HASH.css
: 63.9KB with gzip (376.5Kb without)admin-HASH.js
: 99KB with gzip (318.9Kb without)
Note: If you're using Nginx check: server-configs-nginx
As you may see in included packages, I used ApiDocs to document all routes in api/v1
and controllers in Api
namespace.
You can check the docs at laralte2.bel4.com/api
Note: The API is protected by token, so when you send a request you should include APP-TOKEN
in the header, this value will be compared to APP_TOKEN
in .env
file check this middleware
#FAQ
Creating CRUD in your application is the job you do most. Let's create Post CRUD:
- Add new migration and model :
php artisan make:model Post -m
- Open migration file and add your columns
- Create PostsController :
php artisan make:controller
. fill your resource (you can use CategoriesController with some changes) or, if you are a lazy developer like me, use a snippet and make only 2 changes - Duplicate
resource/views/admin/categories
folder toposts
, make changes inindex.php
,create.blade.php
,edit.blade.php
To move images im using a helper function based on intervention/image and variables.php you can check full example in User.php
- Copy/paste "rtl-dependencies" into "dependencies" section
- Change all
pull-right
topull-left
in default file and vise versa - Uncomment this line in webpack.mix.js
- Run:
yarn upgrade && npm run dev
, you're ready to go ;)
Rest Controllers are in the App\Http\Controllers\Api
namespace.
- Create new controller that extends
ApiController
class - Add your route in
api/v1
route group - Add documentation block (documentation)
- Install ApiDoc via npm, run:
npm install apidoc -g
(only first time) - Run this command :
apidoc -i app/Http/Controllers/Api/ -o public/api/ -t resources/apiTemplate/
- That's all :)
Not hesitate, open new issue ;)