<?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>laravel &#8211; The SIGMA</title>
	<atom:link href="https://danushka96.github.io/sigma/index.php/tag/laravel/feed/" rel="self" type="application/rss+xml" />
	<link>https://danushka96.github.io/sigma/</link>
	<description>&#60;For Those Who Code/&#62;</description>
	<lastBuildDate>
	Sat, 02 Mar 2019 16:57:34 +0000	</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.1.1</generator>
	<item>
		<title>Laravel වලින් Table Relationship එක්ක වැඩ කරමු</title>
		<link>https://danushka96.github.io/sigma/index.php/2019/01/10/laravel-table-relationship/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2019/01/10/laravel-table-relationship/#respond</comments>
				<pubDate>Thu, 10 Jan 2019 10:46:16 +0000</pubDate>
		<dc:creator><![CDATA[Danushka Herath]]></dc:creator>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[elequent]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[relational]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=1516</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">5</span> <span class="rt-label rt-postfix">minutes</span></span> අද ලිපියෙන් කතා කරන්න හදන්නේ Laravel වල තියෙන Feature එකක් ගැන. සාමාන්‍යයෙන් අපි SQL වගේ Relational Database එකක් එක්ක වැඩ කරද්දී අපිට නිතරම ඕන වෙන දෙයක් තමයි එක Table එකක ඉදන් තවත් Table එකක අදාල Data Set එකක් ගන්න එක. ඒ කියන්නේ Relationship එකක් වැඩ කරන එක. මේ වගේ වැඩක්<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2019/01/10/laravel-table-relationship/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/10/laravel-table-relationship/">Laravel වලින් Table Relationship එක්ක වැඩ කරමු</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">5</span> <span class="rt-label rt-postfix">minutes</span></span>
<p>අද ලිපියෙන් කතා කරන්න හදන්නේ Laravel වල තියෙන Feature එකක් ගැන. සාමාන්‍යයෙන් අපි SQL වගේ Relational Database එකක් එක්ක වැඩ කරද්දී අපිට නිතරම ඕන වෙන දෙයක් තමයි එක Table එකක ඉදන් තවත් Table එකක අදාල Data Set එකක් ගන්න එක. ඒ කියන්නේ Relationship එකක් වැඩ කරන එක. මේ වගේ වැඩක් කර ගන්න සාමාන්‍යයෙන් අපි Query එකක් ලිවුවොත් For loop දාගෙන සෑහෙන්න දඟලන්න වෙනවා. </p>



<p>උදාහරණයක් විදියට අපි හිතමු Students, Schools කියලා Table 2ක් තියෙනවා කියලා. එක Student කෙනෙකුට එක School එකක් තියෙනවා‍‍. එක School එකකට Students ලා ගොඩක් ඉන්නවා. මේ වගේ වෙලාවක මට ඕන වෙනවා School Type එක &#8220;mixed&#8221; කියලා තියෙන School වල Student List එකක් හදා ගන්න. දැන් මුලින්ම කරන්න ඕන Student Table එකේ Query එකක් ගහන්න ඕන Mixed type school ටික හොයා ගන්න. ඊට පස්සේ ඒ එක එක School එකට අදාල Student ලා ගන්න ආපහු Query එකක් ලියන්න ඕන. නැත්නම් Table 2ම Join කරගන්න ඕන. ටිකක් වෙලා යන වැඩක්නේ</p>



<p>මේ වැඩේ ලේසියෙන්ම කරගන්න පුළුවන් Laravel Eloquent  එක්ක. මේ වගේ දෙයක් හදා ගන්න විදිය තමයි අද ලිපියෙන් කියලා දෙන්න යන්නේ.</p>



<h3><strong><u>පළමු පියවර</u></strong></h3>



<p>මම මුලින්ම අලුත් Project එකක් හදා ගන්නවා මේ විදියට.. (Laravel install කරලා නැත්නම් මේ <a href="https://danushka96.github.io/sigma/index.php/2018/04/11/install-laravel-homestead-custom/">ලිපිය</a> බලන්න)</p>



<pre class="wp-block-preformatted">composer create-project --prefer-dist laravel/laravel myEloquent</pre>



<p>Project Files ටික හැදිලා ඉවර උනාම කැමති IDE එකකින් Project එක Open කරගන්න. ඊළඟට අපි කරන්න හදන්නේ අපිට ඕන කරන Tables හදා ගන්න එක. මම මේකට පාවිච්චි කරන්නේ උඩදි කිවුව උදාහරණයමයි. ඒ කියන්නේ School, Student and User කියන Scenario එක. </p>



<p><strong>ඒ කියන්නේ School එකකට Students ලා ගොඩයි. Student කෙනෙකුට එක School එකයි. User කෙනෙකුට එක Student කෙනෙක් ඉන්නවා. Student කෙනෙක් කියන්නේ User කෙනෙක්.</strong></p>



<h2><strong><u>දෙවන පියවර</u></strong></h2>



<p>දැන් අපිට ඕන කරන Models ටික හදා ගන්න ඕන. මේ Model හරහා තමයි අපිට Database Queries කරගන්න පුළුවන් වෙන්නේ. දැන් කරන්නේ මේ Model ටිකයි ඒවගේ Migration Files ටිකයි Artisan Commands හරහා Generate කරගන්න එක.</p>



<pre class="wp-block-preformatted">php artisan make:model Student -m</pre>



<pre class="wp-block-preformatted">php artisan make:model School -m</pre>



<p>මේ Command දෙක Run කරාට පස්සේ අපිට අවශ්‍ය කරන Files ටික generate වෙනවා. දැන් ඒ ටික අපිට අවශ්‍ය විදියට Edit කරගන්න තියෙන්නේ. මේකෙදි අපේ තව Table එකක් තියෙනවානේ Users කියලා. මම ඒක මෙතන Generate කරගත්තේ නැත්තේ ඒක Laravel එක්ක Default එන එකක් නිසා.</p>



<p>මුලින්ම අපි බලමු Users Model එකට අපිට අවශ්‍ය Data දාගෙන Table හදා ගන්නේ කොහොමද කියලා.</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App;<br><br>use Illuminate\Notifications\Notifiable;<br>use Illuminate\Contracts\Auth\MustVerifyEmail;<br>use Illuminate\Foundation\Auth\User as Authenticatable;<br><br>class User extends Authenticatable<br>{<br>    use Notifiable;<br><br>    <em>/**</em><br><em>     * The attributes that are mass assignable.</em><br><em>     *</em><br><em>     * @var array</em><br><em>     */</em><br>    protected $fillable = [<br>        'firstName', 'lastName','email', 'password',<br>    ];<br><br>    <em>/**</em><br><em>     * The attributes that should be hidden for arrays.</em><br><em>     *</em><br><em>     * @var array</em><br><em>     */</em><br>    protected $hidden = [<br>        'password', 'remember_token',<br>    ];<br>}<br><br></pre>



<p>මෙතනදි වෙනස් කරලා තියෙන්නේ Default එන name වෙනුවට firstName, lastName 2කට කඩලා තියෙනවා. මේ Model එකට අදාලව Migration File එක මේ විදියට හදා ගන්න.</p>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;<br><br>class CreateUsersTable extends Migration<br>{<br>    <em>/**</em><br><em>     * Run the migrations.</em><br><em>     *</em><br><em>     * @return void</em><br><em>     */</em><br>    public function up()<br>    {<br>        Schema::create('users', function (Blueprint $table) {<br>            $table->increments('id');<br>            $table->string('firstName');<br>            $table->string('lastName');<br>            $table->string('email')->unique();<br>            $table->timestamp('email_verified_at')->nullable();<br>            $table->string('password');<br>            $table->rememberToken();<br>            $table->timestamps();<br>        });<br>    }<br><br>    <em>/**</em><br><em>     * Reverse the migrations.</em><br><em>     *</em><br><em>     * @return void</em><br><em>     */</em><br>    public function down()<br>    {<br>        Schema::dropIfExists('users');<br>    }<br>}<br><br></pre>



<p><strong>Student Model </strong></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App;<br><br>use Illuminate\Database\Eloquent\Model;<br><br>class Student extends Model<br>{<br>    protected $fillable = ['regNumber','contact','school_id','user_id'];<br>}<br><br></pre>



<p><strong>Student Migration</strong></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>use Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;<br><br>class CreateStudentsTable extends Migration<br>{<br>    <em>/**</em><br><em>     * Run the migrations.</em><br><em>     *</em><br><em>     * @return void</em><br><em>     */</em><br>    public function up()<br>    {<br>        Schema::create('students', function (Blueprint $table) {<br>            $table->increments('id');<br>            $table->string('contact');<br>            $table->integer('school_id');<br>            $table->integer('user_id');<br>            $table->timestamps();<br>        });<br>    }<br><br>    <em>/**</em><br><em>     * Reverse the migrations.</em><br><em>     *</em><br><em>     * @return void</em><br><em>     */</em><br>    public function down()<br>    {<br>        Schema::dropIfExists('students');<br>    }<br>}<br><br></pre>



<p>මේකෙදි මම student table එක ඇතුලට School, User  tables වලට අදාල records හඳුන ගන්න school_id, user_id තියා ගන්නවා. සාමාන්‍යයෙන් මේ වගේ foreign keys set කරගන්නකොට &#8220;tablename_id&#8221; විදියට තමයි යොදා ගන්න ඕන.</p>



<p><strong>School Model</strong></p>



<pre class="wp-block-preformatted">&lt;?php<br><br>namespace App;<br><br>use Illuminate\Database\Eloquent\Model;<br><br>class School extends Model<br>{<br>    protected $fillable=['name','contact'];<br>}<br><br></pre>



<p><strong>School Migration</strong></p>



<pre class="wp-block-preformatted"> &lt;?php<br><br>use Illuminate\Support\Facades\Schema;<br>use Illuminate\Database\Schema\Blueprint;<br>use Illuminate\Database\Migrations\Migration;<br><br>class CreateSchoolsTable extends Migration<br>{<br>    <em>/**</em><br><em>     * Run the migrations.</em><br><em>     *</em><br><em>     * @return void</em><br><em>     */</em><br>    public function up()<br>    {<br>        Schema::create('schools', function (Blueprint $table) {<br>            $table->increments('id');<br>            $table->string('name');<br>            $table->string('contact');<br>            $table->timestamps();<br>        });<br>    }<br><br>    <em>/**</em><br><em>     * Reverse the migrations.</em><br><em>     *</em><br><em>     * @return void</em><br><em>     */</em><br>    public function down()<br>    {<br>        Schema::dropIfExists('schools');<br>    }<br>}<br><br></pre>



<p>මේ විදියට අපි Migration Files ටික හදා ගත්තට පස්සේ කරන්න තියෙන්නේ migrate කරගන්න එක. ඒකට මේ Command එක run කරන්න.</p>



<pre class="wp-block-preformatted">php artisan migrate<br></pre>



<p>හරි දැන් අපිට කරන්න තියෙන්නේ relations ටික table වලින් query වෙන විදියට set කරගන්න එක. </p>



<h2><strong>Relationship Types</strong></h2>



<p>Relationship Types ප්‍රධාන වශයෙන් 3ක් තියෙනවා.</p>



<ol><li><strong>One to One</strong></li><li><strong>One to Many</strong></li><li><strong>Many to Many</strong></li></ol>



<p>දැන් අපි set කරන්න යන්නේ student සහ user අතර one to one relationship එකක්. ඒ වගේම student සහ school අතර one to many relationship එකක්. Many to Many Relationship එක set කරගන්න විදිය ගැන මම වෙනම ලිපියකින් කියලා දෙන්නම්. නැත්නම් මෙ Article එක අද ඉවර කරන්න වෙන්නේ නෑ. 😀 </p>



<p>මේ ගැන වැඩිදුර තොරතුරු ඕන නම් මේ <a href="https://laravel.com/docs/5.7/eloquent-relationships">Official Laravel Documentation</a> එක බලන්න</p>



<h3><u><strong>One to One Relationship (Student -> User )</strong></u></h3>



<p>අපි හදා ගත්ත Student Model එකයි User Model එකයි change කරන්න දැන් තියෙන්නේ. මුලින්ම අපි Student Model එක ගැන බලමු.</p>



<p>මේ code එක Student Model එකේ $fillable කියන Array එකට යටින් paste කරගන්න.</p>



<pre class="wp-block-preformatted">public function user(){<br>        <em>return</em> <em>$this</em>->belongsTo('App\User');<br>}</pre>



<p>මේකෙන් අපි කියන්නේ Student Belongs to User කියන එක.</p>



<p>දැන් User Model එක Open කරගෙන මේ Code එක කලින් වගේම $fillable Array එකට යටින් Paste කරගන්න. </p>



<pre class="wp-block-preformatted">public function student(){<br>    <em>return</em> <em>$this</em>->hasOne('App\Student');<br>}</pre>



<p>මෙතනින් කරන්නේ User has one student කියන එක. හැබැයි ඔයාලා දන්නවා ඇති අපිට One to One Relationship එකකදි පුළුවන් කැමති Table එකකට foreign key එක දාලා Relation එක set කරන්න පුළුවන්. දැන් ප්‍රශ්ණයක් තියෙනවානේ මොකටද Belongs to දාන්න ඕන මොකටද HasOne දාන්න ඕන කියලා. ඒක බලන්න ඕන Foreign key එක දාන Table එක අනුව. මේ උදාහරණය අනුව මම User_id field එකක් දැම්මා Students Table එකට.  ඒක නිසා belongsTo දාන්න ඕන Student Model එකට.</p>



<h2><strong><u>One to Many Relationship ( Student->School)</u></strong></h2>



<p>දැන් වෙන්න ඕන වැඩේ තේරෙනවානේ. අපිට කරන්න තියෙන්නේ Model අතර සම්බන්ධතාවක් හදා ගන්න. ඒකෙන් Relationship Set වෙනවා. </p>



<p>අපි ආපහු student model එකෙන් වැඩේ පටන් ගමු. මේ Code එක User() කියලා උඩදි දාපු function එකට පහලින් දාගන්න.</p>



<pre class="wp-block-preformatted">public function school(){<br>     <em>return</em> <em>$this</em>->belongsTo('App\School');<br>}</pre>



<p>මේක School Model එකට දාගන්න.</p>



<pre class="wp-block-preformatted">public function students(){<br>    <em>return</em> <em>$this</em>->hasMany('App\Student');<br>}</pre>



<p>කලින් වගේම මෙක one-to-many relationship එකක් නිසා අපි කරන්නේ Student Belongs to School relation එකයි school has many students එකයි මේ විදියට set කරගන්න එක. </p>



<p>දැන් අපි බලමු හරියට මේ relation set වුණාද කියලා. ඒක කරන්න අපිට පොඩි tool එකක් තියෙනවා artisan commands වල. ඒක තමයි <strong>Tinker .  </strong>මේක යොදාගෙන අපිට ගොඩක් ප්‍රයෝජන ගන්න පුළුවන්. හැබැයි මේකෙදි අපි කතා කරන්නේ relations set කරගන්නේ කොහොමද කියලා. </p>



<p>මුලින්ම Project එක open කරලා තියෙන IDE එකේ terminal එක open කරගෙන මේ Command එක run කරවන්න. </p>



<pre class="wp-block-preformatted">php artisan tinker</pre>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Screenshot-from-2019-01-10-13-51-14.png" alt="" class="wp-image-1526" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Screenshot-from-2019-01-10-13-51-14.png 642w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Screenshot-from-2019-01-10-13-51-14-300x45.png 300w" sizes="(max-width: 642px) 100vw, 642px" /><figcaption>tinker Screen shot</figcaption></figure>



<p>දැන් සාමාන්‍යයෙන් php වලින් variable assign කරන විදියට මේ වගේ type කරලා run කරගන්න. ඊට කලින් Database එකට Data ටිකක් දාගෙන ඉන්න. නැත්නම් බලන්න වෙන්නේ නෑ.</p>



<pre class="wp-block-preformatted">$user  = \App\Student::first()<br></pre>



<p>මේක මුලින්ම tinker එකේ type කරලා බලන්න result එකක් එනවද කියලා. error එකක් එනවා නම් Comment එකක් දාන්න නැත්නම් Google කරලා බලන්න අනිවාර්‍යයෙන් ඇති. මෙකෙදි ඔයා දාපු පළවෙනි data එක ආවොත් මේ ඊළඟ එක දාලා බලන්න.</p>



<pre class="wp-block-preformatted">$user->user</pre>



<p>මෙකෙදි පෙන්නන්නේ student ට අදාල user කවුද කියන එක. මේක අපි මුලින්ම set කරා Model එකේ one to one relationship එකක්. දැන් අපිට කිසිම Query එකක් ලියන්නේ නැතුව මේ Eloquent එක හරහා අදාල Data ගන්න පුළුවන්. මේ වගේම දැන් try කරලා බලමු school එක ගන්න පුළුවන්ද කියලා. </p>



<pre class="wp-block-preformatted">$user->school</pre>



<p>මේකෙදි හරියට Result එකක් ආවා කියන්නේ අපේ relation ටික වැඩ කියන එක. ඕන නම් School Object එකක් හදලා බලමු Students ලා ගන්න පුළුවන්ද කියලා.</p>



<pre class="wp-block-preformatted">$school = \App\School::first()<br><br>$school->students</pre>



<p>දැන් හරියට Data ටික එනවා කියන්නේ Result එක හරි. මේ විදියට අලුතින් Model හදලා Query කරලා බලන්න. අනිත් එක තමයි අපි model එක ඇතුලෙ relations methods විදියට ලිවුවට මෙතනදි ඒ method එක call කරන්නේ Function එකක් විදියට නෙවෙයි. නිකන්ම attribute එකක් විදියට. ඒ ගැන සැලකිලිමත් වෙන්න. මේ විදියටම tinker එකේ call කරා වගේ අපිට Controller එකක් හරි View එකක් හරි ඇතුලෙදිත් මේ වගේ Data retrieve කර ගන්න පුළුවන්.</p>



<p>හරි එහෙනම් මොකක් හරි ප්‍රශ්ණයක් තිබුණොත් අහන්න. ඊළඟ tutorial එකෙන් Many to Many එකක් set කරගෙන් වැඩ කරන විදිය බලමු. </p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/10/laravel-table-relationship/">Laravel වලින් Table Relationship එක්ක වැඩ කරමු</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2019/01/10/laravel-table-relationship/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Laravel වලින් Database Migrations කරමු.</title>
		<link>https://danushka96.github.io/sigma/index.php/2018/09/17/laravel-database-migrations/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2018/09/17/laravel-database-migrations/#respond</comments>
				<pubDate>Mon, 17 Sep 2018 18:24:22 +0000</pubDate>
		<dc:creator><![CDATA[Danushka Herath]]></dc:creator>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sinhala]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=1271</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span> Web Application එකක් හදද්දි අපිට අවශ්‍යම වෙන දෙයක් තමයි Migration එහෙම නැත්නම් Database එක්ක ගණුදෙනු කරන එක. Database එකක් නැතිව Web Application එකකින් ගොඩක් දුරට තේරුමක් වෙන්නේ නෑ. අද කතා කරන්න යන්නේ Laravel එක්ක Database Migrations වැඩ ටික කරගන්නේ කොහොමද කියලා&#8230;&#8230; වෙනදා වගේම කියන්න ඕන මේක ඔයා බලන පළවෙනි laravel<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2018/09/17/laravel-database-migrations/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/09/17/laravel-database-migrations/">Laravel වලින් Database Migrations කරමු.</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span>Web Application එකක් හදද්දි අපිට අවශ්‍යම වෙන දෙයක් තමයි Migration එහෙම නැත්නම් Database එක්ක ගණුදෙනු කරන එක. Database එකක් නැතිව Web Application එකකින් ගොඩක් දුරට තේරුමක් වෙන්නේ නෑ. අද කතා කරන්න යන්නේ Laravel එක්ක Database Migrations වැඩ ටික කරගන්නේ කොහොමද කියලා&#8230;&#8230;</p>
<p>වෙනදා වගේම කියන්න ඕන මේක ඔයා බලන පළවෙනි laravel post එක නම් අපේ අනිත් ලිපි Set එකත් <a href="https://danushka96.github.io/sigma/index.php/2018/04/10/web-application-with-laravel/">මෙතනින්</a> බලන්න.</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/Why_Laravel-300x171.jpg" alt="" width="523" height="298" class=" wp-image-1273 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/Why_Laravel-300x171.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/Why_Laravel.jpg 700w" sizes="(max-width: 523px) 100vw, 523px" /></p>
<h2><span style="text-decoration: underline; color: #0000ff;"><strong>මූලික හැඳින්වීම</strong></span></h2>
<p>උඩ තියෙන Image එක කියන්නේ Why Laravel කියන ප්‍රශ්නෙට තියෙන උත්තර. ඒ කියන්නේ අනිත් PHP Frameworks එක්ක compare කරලා බලද්දි Laravel වල තියෙන විශේෂත්වය. ඒකෙ උඩින්ම තියෙන දෙයක් තමයි මේ Migrations කියන එක. ඒකට ගොඩක් specialty එකක් දීලා තියෙන්නේ ඒකෙන් ලොකු වැඩ ගොඩක් Simple විදියට කරගන්න අවස්ථාවක් තියෙන හින්දා.</p>
<p>සාමාන්‍යයෙන් අපි මොකක්ම හරි Web Application එකක් Laravel නැතිව වෙනත් විදියකින් හදනවා නම් අපි කරන්නේ අපේ Source Code එක වෙනම හදලා Database එක වෙනම හදලා මේ දෙක php වලින් Connect කරගන්න එකනේ. දැන් හිතන්න ඔය System එක තවත් කාට හරි දෙන්න ඕන වුණා කියලා. එතකොට අපිට සිද්ධ වෙනවා අපේ source code එකත් එක්ක SQL Server එකෙන් export කරගත්තු database file එකත් දෙන්න. ඊට පස්සේ මේ system එක ගන්න කෙනා ආපහු ඒ database එක import කරගන්න. මොකක්ම හරි Error එකක් ඇවිත් අර database file එක import වෙන්නේ නැති වුණොත් අපිට ආපහු ඒ file එක edit කරන එක ඇත්තටම අමාරු වැඩක්. මොකද ඒකෙ තියෙන්නේ generate වෙලා තියෙන code set එකක් නිසා.</p>
<p>තවත් ප්‍රශ්ණයක් තමයි අපි හදන Database එක වැඩ කරන්නේ Mysql නම් Mysql server එකක විතරයි. අපිට වෙනත් platform එකකට මාරු වෙන්න ඕන වුණොත් අපිට Database එක redesign කරන්නත් සිද්ධ වෙනවා.</p>
<h5><span style="color: #ff6600;"><strong>Laravel වල තියෙන විසඳුම මොකද්ද?</strong></span></h5>
<p>සරලවම මේ ප්‍රශ්ණෙට laravel වල තියෙන විසඳුම තමයි Database Migration කියන්නේ. ඒ කියන්නේ අපි Database එක හදන්නෙත් අපේ System එකට අදාල files වලමයි. එතකොට අපිට තවත් කෙනෙකුට System එක දෙනකොට දෙන්න තියෙන්නේ අපි හදලා තියෙන system file set එක විතරයි. ඊට පස්සේ artisan වල තියෙන migrate command එක භාවිතා කරලා ඕනම කෙනෙකුට තමන්ගේ db එක හදා ගන්න පුළුවන්.</p>
<p>දැන් අපි මුල ඉඳන් මේ වැඩේ කරන්න ඕන කොහොමද කියලා බලමු.</p>
<p>&nbsp;</p>
<h3 style="text-align: center;"><span style="color: #ff9900;">Migration File එකක් හදාගමු.</span></h3>
<p style="padding-left: 30px;">මෙහෙම migrate files generate කරගන්න අපි භාවිතා කරන්නේ command prompt/terminal එක. ඒක නිසා මුලින්ම ඔයාලගෙ project එක (අලුත් project එකක් වුණොත් හොඳයි) තියෙන directory එක ඇතුලෙ command prompt එක හරි terminal එක හරි open කරගන්න ඕන.</p>
<p style="padding-left: 30px;">ඊට පස්සේ එකෙ මේ command එක ගහන්න.</p>
<pre style="padding-left: 30px;">php artisan make:migration create_users_table</pre>
<p style="padding-left: 30px;">මෙකෙ create_users_table කියන්නේ අපේ migration file එකේ නම. මේකට ඔයාලට කැමති නමක් දෙන්න පුළුවන්. මම user table එකක් හදන්න යන නිසා මේක දානවා. මේ Command එක run වුණාට පස්සේ database/migrations folder එක ඇතුලෙ අලුතින් file එකක් හැදෙනවා. මේ file එක හැදෙන්නේ ඕනම database operation එකක් කරගන්න ගැලපෙන විදියට.</p>
<p style="padding-left: 30px;">හැබැයි අපි දැන් කරන්න හදන්නේ අලුතින් table එකක් හදා ගන්න එක. ඒ වැඩේට විතරක් ගැලපෙන විදියට අපේ migration file එක හදා ගන්න ඕන නම් මේ විදියට command එක වෙනස් කරලා දෙන්න පුළුවන්.</p>
<pre style="padding-left: 30px;">php artisan make:migration create_users_table --create=users
</pre>
<h3 style="text-align: center;"><span style="color: #ff9900;">Migration File Structure</span></h3>
<p style="padding-left: 30px;">දැන් අපි බලන්න හදන්නේ කලින් පියවරේදි අපි generate කරගත්ත migration file එකේ structure එක තියෙන්නේ කොහොමද කියලා. ඒකට මේ මම පොඩි Table එකක් හදා ගන්න පුළුවන් Migration file එකක් මේ විදියට ලියා ගන්නවා. මෙකෙ table name එක flights.</p>
<pre>&lt;?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFlightsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('flights', function (Blueprint $table) {
            $table-&gt;increments('id');
            $table-&gt;string('name');
            $table-&gt;string('airline');
            $table-&gt;timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('flights');
    }
}

</pre>
<p style="padding-left: 30px;">මේකෙ දැන් ඔයාලට පේනවා ඇති up, down කියලා methods දෙකක් තියෙනවා. අපි up කියන method එක ඇතුලේ ලියන්නේ අලුතින් Table එකක්, column එකක්, නැත්නම් indexes Create කරන Queries. Down method එක ඇතුලේ ලියවෙන්නේ up method එක reverse කරන query set එක. දැන් අපි බලන්න හදන්නේ Migration commands කිහිපයක් කරගන්න විදිය.</p>
<h3 style="text-align: center;"><span style="color: #ff6600;">Migration Commands</span></h3>
<h4 style="padding-left: 30px;"><span style="color: #ff9900;">Migration File එකක් run කරගන්න විදිය</span></h4>
<pre class=" language-php" style="padding-left: 30px;"><code class=" language-php">php artisan migrate</code></pre>
<p style="padding-left: 30px;">මේ command එක හරහා අපි හදලා තියෙන Migration files ඔක්කොම ටික අපිට Database server එක ඇතුලෙ run කරගන්න පුළුවන්.</p>
<h4 style="padding-left: 30px;"><span style="color: #ff9900;">Run වුන migration එකක් rollback (ආපහු මුල් තත්වෙට) කරගන්න විදිය</span></h4>
<pre class=" language-php" style="padding-left: 30px;"><code class=" language-php">php artisan migrate:rollback</code></pre>
<p style="padding-left: 30px;">මේ command එකෙන් අපි අන්තිමට run කරපු migration files ටික හරහා සිද්ධ වුණ changes ටික reverse කරගන්න එහෙම නැත්නම් rollback කරගන්න පුළුවන්.</p>
<pre class=" language-php" style="padding-left: 30px;"><code class=" language-php">php artisan migrate:rollback --step=5</code></pre>
<p style="padding-left: 30px;">මේ විදියෙන් අපිට rollback කරන්න ඕන steps ගාන දෙන්න පුළුවන්&#8230;</p>
<pre class=" language-php" style="padding-left: 30px;"><code class=" language-php">php artisan migrate:reset</code></pre>
<p style="padding-left: 30px;">මේ Command එකෙන් අපේ Database එකට migration files වලින් වුණු හැම change එකක්ම අයින් වෙනවා..</p>
<pre class=" language-php" style="padding-left: 30px;"><code class=" language-php">php artisan migrate:refresh</code></pre>
<p style="padding-left: 30px;">මේකෙන් අපිට උඩින් කතා කරපු step දෙකක් එක command එකෙන් කරගන්න පුළුවන්. ඒ කියන්නේ Database එක reset කරගෙන migrations files ටික run කරගන්න එක.</p>
<pre class=" language-php" style="padding-left: 30px;"><code class=" language-php">php artisan migrate:fresh</code></pre>
<p style="padding-left: 30px;">මෙකෙන් කලින් කරපු වැඩේට ටිකක් සමාන වැඩක් කරගන්න පුළුවන්. හැබැයි මේකෙදි database එක reset වෙන්නේ නැතිව වෙන්නේ ඔක්කොම Tables ටික ඉස්සරලාම drop කරගන්න එක. ඊට පස්සේ Migration files ටික run කරගන්නවා.</p>
<p>ලිපිය තවත් දික් වෙලා Boring වෙන නිසා මම Database Queries ලියා ගන්න විදිය ගැන තවත් ලිපියකින් කතා කරන්නම්. මේ ලිපිය ගැන මොකක් හරි ප්‍රශ්ණයක් තියෙනවා නම් Comment එකක් දාන්න. අලුත් ලිපියකින් හමු වෙමු&#8230;..</p>
<p>&nbsp;</p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/09/17/laravel-database-migrations/">Laravel වලින් Database Migrations කරමු.</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2018/09/17/laravel-database-migrations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Laravel- Middleware</title>
		<link>https://danushka96.github.io/sigma/index.php/2018/09/14/laravel-middleware/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2018/09/14/laravel-middleware/#comments</comments>
				<pubDate>Fri, 14 Sep 2018 03:10:55 +0000</pubDate>
		<dc:creator><![CDATA[Gayan Sampath]]></dc:creator>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[laravel]]></category>
		<category><![CDATA[middleware]]></category>
		<category><![CDATA[route]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=1251</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">4</span> <span class="rt-label rt-postfix">minutes</span></span> ආයුබෝවන්! කොහොමද යාලුවනේ..ඔන්න මම අදත් ආවා laravel framework එකේ තියන තවත් future එකක් පිලිබදව විස්තරත් සමගින්..මුලින්ම කියන්න ඕනි ඔයාලා කාට හරි අපේ මුල පාඩම් ටික මගහැරුනනම් මෙන්න මෙතනින් ගිහින් බලන්න පුලුවන්..හරි අපි එහෙනං අද පාඩමට බහිමු.අද පාඩම තමයි middleware. ඇත්තටම laravel වල තියන ගොඩක් හොද future එකක් තමයි middleware කියන්නේ..කෙටියෙන්ම<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2018/09/14/laravel-middleware/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/09/14/laravel-middleware/">Laravel- Middleware</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">4</span> <span class="rt-label rt-postfix">minutes</span></span>ආයුබෝවන්! කොහොමද යාලුවනේ..ඔන්න මම අදත් ආවා laravel framework එකේ තියන තවත් future එකක් පිලිබදව විස්තරත් සමගින්..මුලින්ම කියන්න ඕනි ඔයාලා කාට හරි අපේ මුල පාඩම් ටික මගහැරුනනම් <a href="https://danushka96.github.io/sigma/index.php/category/web-development/laravel/" target="_blank" rel="noopener">මෙන්න මෙතනින්</a> ගිහින් බලන්න පුලුවන්..හරි අපි එහෙනං අද පාඩමට බහිමු.අද පාඩම තමයි middleware. ඇත්තටම laravel වල තියන ගොඩක් හොද future එකක් තමයි middleware කියන්නේ..කෙටියෙන්ම කිව්වොත් middleware එකක් කියන්නේ user හා request එක අතරමැද තියන layer එකක්. මෙන්න මේ layer (middleware ) එකෙන් තමයි user ට system එක access කරන්ට permition ලබා දෙන්නේ ..</p>
<p>laravel folder structure එක ගත්තොත් middleware එක තියෙන්නේ App/Http/Middleware කියන තැන. මේ Middleware folder එක ඇතුලට ගියාම ඔයාලට දැකගන්න පුලුවන් laravel වල default එන middlewares කිහිපයක්ම තියනවා.(VerifyCsrfToken , Authenticate , EncryptCookies. ..etc).අපිට ඕනි නම් middleware එකක් හදන්න පුලුවන්</p>
<pre>php artisan make:middleware &lt;middleware_name&gt;</pre>
<p>කියන artisan command එක run කරලා.middleware එකක් හදා ගත්තට පසුව අපි පලමුවෙන්ම කරන්න ඕනි දේ තමයි හදාගත්ත middleware එක App/Http/Kernel.php එකේ register කර ගන්න එක. හරි ඔන්න ඕකයි සිද්ධිය..☺☺..පොඩ්ඩක් පොඩ්ඩක් අව්ල් වගේනං අපි පොඩි උදාහරණයක්ම ඇරගෙන වැඩේ කරලා බලමුකෝ..😃😃</p>
<p>හරි මම middleware එකක් හදා ගන්නවා checkIp කියලා..</p>
<pre>php artisan make:middleware checkIp</pre>
<p>ඊට පස්සේ ඒ හදා ගත්ත middleware එක මෙන්න මේ විදියට kernel එකේ register කර ගන්නවා..</p>
<pre>&lt;?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [ \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \App\Http\Middleware\TrustProxies::class, ]; /** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' =&gt; [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' =&gt; [
            'throttle:60,1',
            'bindings',
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'auth' =&gt; \App\Http\Middleware\Authenticate::class,
        'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' =&gt; \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'cache.headers' =&gt; \Illuminate\Http\Middleware\SetCacheHeaders::class,
        'can' =&gt; \Illuminate\Auth\Middleware\Authorize::class,
        'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
        'signed' =&gt; \Illuminate\Routing\Middleware\ValidateSignature::class,
        'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'verified' =&gt; \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
        
        'checkIp'=&gt; \App\Http\Middleware\checkIp::class,
    ];
}


</pre>
<p>හරි මට දැන් කරන්න ඕනි දේ තමයි 127.0.0.1 කියන Ip address එකින් request එකක් ආවොත් එයා system එකට ඇතුලු වෙන එක වලක්වන එක. එතකොට අපි checkIp කියන middleware එකේ මෙහෙම කලානම් හරි නේද&#8230;</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/ch-300x211.jpg" alt="" width="635" height="447" class=" wp-image-1289 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/ch-300x211.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/ch.jpg 632w" sizes="(max-width: 635px) 100vw, 635px" /></p>
<p>හරි දැන් මෙන්න මේ විදියට rote එකයි view එකකුයි set කරලා run කරලා බලන්නකෝ&#8230;</p>
<p>Route ;</p>
<pre>Route::get('/home',function(){
    return view('testView.home');
})-&gt;middleware('checkIp');

</pre>
<p>output</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-300x133.jpg" alt="" width="686" height="304" class=" wp-image-1256 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-300x133.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-768x340.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-1024x454.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check.jpg 1354w" sizes="(max-width: 686px) 100vw, 686px" /></p>
<p>වැඩේ හරි නේද&#8230;127.0.0.1 කියන ip එකෙන් එන requests වලට system එක access කරන්න එක middleware එකෙන් වලක්වලා තියෙන්නේ..</p>
<p>ඔන්න ඔය විදියට route එකට middleware එක set කරනවට අමතරව අපිට පුලුවන් middleware එක controller එකක් ඇතුලට set කරන්න&#8230;එහෙම කලාම වෙන්නේ ඒ controller එකේ තියන සියලුම methods සදහාම middleware එකෙන් ආරක්ෂාවක් සැලසීමයි..controller එකට middleware එක අපි set කරන්නේ __construct() කියන method එක එකේදී..හරි අපි එහෙනං ඒකත් කරලා බලමු.</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/middleware-300x185.jpg" alt="" width="635" height="392" class=" wp-image-1290 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/middleware-300x185.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/middleware.jpg 632w" sizes="(max-width: 635px) 100vw, 635px" /></p>
<p>දැන් පුරුදු විදියටම route එකයි view එකයි set කරලා output එක බලන්නකෝ&#8230;</p>
<p>Route -&gt;</p>
<pre> Route::get('/home','studentController@index');
</pre>
<p>Output</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-300x133.jpg" alt="" width="672" height="298" class="wp-image-1256 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-300x133.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-768x340.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check-1024x454.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/check.jpg 1354w" sizes="(max-width: 672px) 100vw, 672px" /></p>
<p>ඔන්න ඔය විදියට තමයි middleware එකක් set කරන්නේ..middleware එකට වැඩි ගනනක් අපිට set කරන්න ඕනිනම්, middlewares ටික __constructor() method එකේ parameters විදියට අපිට pass කරන්න පුලුවන්.හරියට මෙන්න මේ විදියට&#8230;</p>
<p>demo1,demo2,demo3 කියලා middlewares තුනක් මං ගන්නම්..</p>
<pre>public function __construct(){
        $this-&gt;middleware('demo1','demo2','demo3');
}
</pre>
<p>ඔන්න ඔය විදියට තමයි multiple middlewares set කරන්නේ&#8230; middlewares ගොඩක් තියනවනම් controllers විශාල ගානකට set කරන්න ආමාරුයි නේ&#8230;😯😯 අන්න ඒ නිසා අපිට පුලුවන් ඒවා kernel එකේදීම ඒවා ටික group කරගන්න..හරි මගේ demo1,demo2 සහ demo3 කියන middlewares ටික group කරලා ඒකට මම නමක් දෙනවා demo කියලා&#8230;</p>
<pre>    protected $middlewareGroups = [
        'web' =&gt; [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' =&gt; [
            'throttle:60,1',
            'bindings',
        ],

        'demo'=&gt;[
            'demo1',
            'demo2',
            'demo3',
        ],
    ];


</pre>
<p>දැන් middleware එක controller එකට set කරමු&#8230;</p>
<pre>public function __construct(){
        $this-&gt;middleware('demo');
}
</pre>
<p>හරි අපි දැන් හිතමු කලින් database එකේ ඉන්න user කෙනෙක්ට system එක access කරන එක වලක්වන්න ඕනි කියලා&#8230;අන්න එතකොට middleware එක set කරන්නේ කොහොමද කියලා දැන් අපි බලමු.<br />
මගේ database එකට නමක් දෙනවා studentdatabase කියලා..ඒකේ තියන student table එක සලකමුකෝ&#8230;</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/database-300x135.jpg" alt="" width="627" height="282" class="wp-image-1257 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/database-300x135.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/database-768x346.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/database-1024x461.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/database.jpg 1110w" sizes="(max-width: 627px) 100vw, 627px" /></p>
<p>දැන් මට ඕනි name එක &#8216;smith&#8217; කියලා තියන student , system එක access කරන එක වලක්වන්ට..එතකොට route එක මෙන්න මේ විදියට set කරන්න පුලුවන්..</p>
<pre> Route::get('/profileInfo',function(){
    return view('testView.prof');
})-&gt;middleware('profile:smith');

</pre>
<p>route එක ඔන්න ඔය විදියට set කරන්න පුලුවන්..middleware එක මෙන්න මේ විදියට define කලානම් හරි නේද..</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/prof-300x254.jpg" alt="" width="586" height="496" class=" wp-image-1297 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/prof-300x254.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/prof.jpg 622w" sizes="(max-width: 586px) 100vw, 586px" /></p>
<p>Output එකත් බලන්නකෝ&#8230;</p>
<p><img src="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/name-300x129.jpg" alt="" width="585" height="252" class=" wp-image-1258 aligncenter" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2018/09/name-300x129.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/name-768x331.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/name-1024x442.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2018/09/name.jpg 1366w" sizes="(max-width: 585px) 100vw, 585px" />;</p>
<p>හරි නේද &#8230;&#8217;smith&#8217; user ට system එක access කරන්න දෙන එක middleware එකෙන් වලක්වලා තියෙන්නේ&#8230;.</p>
<p>හරි ඔන්න ඔය ටික තමයි middleware එක ගැන කියන්ට තියෙන්නේ&#8230;අදට පාඩම ඉවරයි..ඔයාලගේ අදහස් කියලා comment එකක් දාන්නත් අමතක කරන්න එපා..project එකට අදාල source code එක පහල තියන link එකට ගිහින් බලාගන්න පුලුවන්..සුබ දවසක් හැමෝටම !</p>
<p><a href="https://github.com/GayanSampathManamendra/demoProject">GitHub Source Code</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2018/09/14/laravel-middleware/">Laravel- Middleware</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2018/09/14/laravel-middleware/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
							</item>
	</channel>
</rss>
