<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>命令 &#8211; 萧邦的博客</title>
	<atom:link href="https://www.zlhlab.top/tag/%e5%91%bd%e4%bb%a4/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.zlhlab.top</link>
	<description>If not me who, If not now when</description>
	<lastBuildDate>Sat, 28 Oct 2017 14:26:04 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.6</generator>
	<item>
		<title>Laravel5.4 artisan常见命令</title>
		<link>https://www.zlhlab.top/laravel5-4-artisan%e5%b8%b8%e8%a7%81%e5%91%bd%e4%bb%a4/</link>
		
		<dc:creator><![CDATA[萧邦]]></dc:creator>
		<pubDate>Tue, 15 Aug 2017 02:52:21 +0000</pubDate>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[artisan]]></category>
		<category><![CDATA[Laravel5]]></category>
		<category><![CDATA[命令]]></category>
		<guid isPermaLink="false">https://www.zlhlab.top/?p=172</guid>

					<description><![CDATA[使用Laravel5.4框架进行php后台搭建，合理使用框架提供的artisan命令，可以较快捷的生成相关模板<div class="more-link">
				 <a href="https://www.zlhlab.top/laravel5-4-artisan%e5%b8%b8%e8%a7%81%e5%91%bd%e4%bb%a4/" class="link-btn theme-btn"><span>Read More </span> <i class="fa fa-caret-right"></i></a>
			</div>]]></description>
										<content:encoded><![CDATA[<p>使用<code>Laravel5.4</code>框架进行php后台搭建，合理使用框架提供的<code>artisan</code>命令，可以较快捷的生成相关模板。</p>
<h4>1、常见命令</h4>
<h5>查看artisan命令</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan
php artisan list
</code></pre>
<h5>查看帮助命令</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan help
</code></pre>
<h5>查看所有命令</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan list
</code></pre>
<h5>查看laravel版本</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan --version
</code></pre>
<h5>使用 PHP 内置的开发服务器启动应用</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan serve
</code></pre>
<p>生成一个随机的 key，并自动更新到 <code>app/config/app.php</code> 的 <code>key</code> 键值对（刚安装好需要做这一步）</p>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan key:generate
</code></pre>
<h5>开启Auth用户功能</h5>
<p>（开启后需要执行迁移才生效）</p>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:auth
php artisan migrate
</code></pre>
<h5>开启维护模式和关闭维护模式（显示503）</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan down
php artisan up
</code></pre>
<h5>进入tinker工具</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan tinker
</code></pre>
<h5>列出所有的路由</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan route:list
</code></pre>
<h5>生成路由缓存以及移除缓存路由文件</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan route:cache
php artisan route:clear
</code></pre>
<h4>2、功能篇</h4>
<h5>创建控制器</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:controller StudentController
</code></pre>
<h5>创建Rest风格资源控制器</h5>
<p>（带有index、create、store、edit、update、destroy、show方法）</p>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:controller PhotoController --resource
</code></pre>
<h5>创建模型</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:model Student
</code></pre>
<h5>创建新建表的迁移和修改表的迁移</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:migration create_users_table --create=students //创建students表

php artisan make:migration add_votes_to_users_table --table=students//给students表增加votes字段
</code></pre>
<h5>执行迁移</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan migrate
</code></pre>
<h5>创建模型的时候同时生成新建表的迁移</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:model Student -m
</code></pre>
<h5>回滚上一次的迁移</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan migrate:rollback
</code></pre>
<h5>回滚所有迁移</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan migrate:reset
</code></pre>
<h5>创建填充</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:seeder StudentTableSeeder
</code></pre>
<h5>执行单个填充</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan db:seed --class=StudentTableSeeder
</code></pre>
<h5>执行所有填充</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan db:seed
创建中间件（app/Http/Middleware 下）
php artisan make:middleware Activity
</code></pre>
<h5>创建队列（数据库）的表迁移（需要执行迁移才生效）</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan queue:table
</code></pre>
<h5>创建队列类（app/jobs下）：</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:job SendEmail
</code></pre>
<h5>创建请求类（app/Http/Requests下）</h5>
<pre class="line-numbers prism-highlight" data-start="1"><code class="language-php">php artisan make:request CreateArticleRequest
</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
