建立項目:composer create-project laravel/laravel xcblog
composer create-project laravel/laravel=5.1.* xcblog --prefer-dist ?制定lar版本為5.1
修改storage文件權限為777
chmod -R 777 storage
修改項目名稱:php artisan app:name xcblog ? ? ? ? ?提示:Application namespace set! 修改了現(xiàn)有的Model的namespace為xcblog
使用composer 建立 數(shù)據(jù)庫文件 ?model ?controller view 文件;
1:建立 數(shù)據(jù)庫文件:
創(chuàng)建article 表 ?php artisan make:migration create_articles_table --create=articles
創(chuàng)建pages單頁面數(shù)據(jù) ? ? php artisan make:migration create_pages_table --create=pages
創(chuàng)建pages單頁面數(shù)據(jù) ? ? php artisan make:migration create_categories_table --create=categories
執(zhí)行插入數(shù)據(jù)庫:php artisan migrate
2:創(chuàng)建model
php artisan make:model Article
php artisan make:model Page
php artisan make:model Category
3:數(shù)據(jù)填充
創(chuàng)建填充文件
修改 DatabaesSeeder.php
插入
$this->call(PageTableSeeder::class);
執(zhí)行填充命令;
composer dump-autoload
php artisan db:seed
4:創(chuàng)建控制器
php artisan make:controller Admin/AdminHomeController
5:創(chuàng)建視圖