<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bijay Kumar Pun</title>
    <description>The latest articles on DEV Community by Bijay Kumar Pun (@bijaykumarpun).</description>
    <link>https://dev.to/bijaykumarpun</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F256752%2Ff00ab731-a206-47c7-8e8a-128f7d16a21d.jpeg</url>
      <title>DEV Community: Bijay Kumar Pun</title>
      <link>https://dev.to/bijaykumarpun</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bijaykumarpun"/>
    <language>en</language>
    <item>
      <title>RAD And V Models of SDLC</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Mon, 28 Mar 2022 03:14:15 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/rad-and-v-models-of-sdlc-12hn</link>
      <guid>https://dev.to/bijaykumarpun/rad-and-v-models-of-sdlc-12hn</guid>
      <description>&lt;p&gt;&lt;em&gt;SDLC - Software Development Life Cycle&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is SDLC ?&lt;/strong&gt;&lt;br&gt;
SDLC is a structured process that aims at developing &lt;em&gt;high quality software&lt;/em&gt;, at the &lt;em&gt;lowest cost&lt;/em&gt; with &lt;em&gt;shortest production time&lt;/em&gt;. International standard for software lifecycle process is defined in &lt;a href="https://en.wikipedia.org/wiki/ISO/IEC_12207"&gt;ISO/IEC 12207&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SDLC Stages:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Plan&lt;/li&gt;
&lt;li&gt;Design&lt;/li&gt;
&lt;li&gt;Implement (Develop)&lt;/li&gt;
&lt;li&gt;Test&lt;/li&gt;
&lt;li&gt;Deploy&lt;/li&gt;
&lt;li&gt;Maintain&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;SDLC Models:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Waterfall Model (1970s to 90s)&lt;/li&gt;
&lt;li&gt;Prototyping Model&lt;/li&gt;
&lt;li&gt;Iterative Model&lt;/li&gt;
&lt;li&gt;Spiral Model&lt;/li&gt;
&lt;li&gt;V-shaped Model&lt;/li&gt;
&lt;li&gt;Agile&lt;/li&gt;
&lt;li&gt;Scrum&lt;/li&gt;
&lt;li&gt;Kanban&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;V-shaped Model&lt;/strong&gt;&lt;br&gt;
This model is also known as &lt;em&gt;Verification and Validation model&lt;/em&gt;, and is an extension of Waterfall model with testing phase integrated in each SDLC stage. Thus, in this model, Testing and Development goes in Parallel. &lt;/p&gt;

&lt;p&gt;Requirements &amp;lt;----------&amp;gt; Acceptance Testing&lt;br&gt;
Specification &amp;lt;--------&amp;gt; System Testing&lt;br&gt;
Architectural Design &amp;lt;------&amp;gt; Integration Testing&lt;br&gt;
Detailed Design &amp;lt;-------&amp;gt; Unit Testing&lt;br&gt;
&amp;lt; Coding &amp;gt;&lt;/p&gt;

&lt;p&gt;The coding phase connects validation phase and verification phase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Highly disciplined model, easy to understand and manage&lt;/li&gt;
&lt;li&gt;Effective for projects where requirements are fixed and well understood &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Less adaptive to change&lt;/li&gt;
&lt;li&gt;Not appropriate for large and complicated projects &lt;/li&gt;
&lt;li&gt;Working software is produced towards the end only&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;RAD Model&lt;/strong&gt;&lt;br&gt;
RAD (Rapid Application Development) is a combination of Prototyping and Iterative models. In this model a working model of the product is rapidly developed and iterated to fit the requirement of the customer. This also means the writing of the software phase itself involves collecting requirement for the development phase.&lt;br&gt;
In RAD model there is minimal planning as the product changes rapidly with each iteration. Unlike V-shaped model where the working product is only obtained towards the end, in RAD model workable product (prototype) is delivered on every iteration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Phases of RAD&lt;/li&gt;
&lt;li&gt;Business modeling&lt;/li&gt;
&lt;li&gt;Data Modeling&lt;/li&gt;
&lt;li&gt;Process Modeling&lt;/li&gt;
&lt;li&gt;Application Generation&lt;/li&gt;
&lt;li&gt;Testing and Turnover&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These phases are iterated over and over until the required product is reached.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Highly adaptive to change&lt;/li&gt;
&lt;li&gt;Reduced development time&lt;/li&gt;
&lt;li&gt;Least planning required&lt;/li&gt;
&lt;li&gt;Feedback oriented&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;System &lt;strong&gt;must&lt;/strong&gt; be modular to be iterative&lt;/li&gt;
&lt;li&gt;High cost for smaller projects due to multiple iterations&lt;/li&gt;
&lt;li&gt;Demands user's involvement&lt;/li&gt;
&lt;li&gt;Highly skilled developers needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;DevOps Internship Assignment | Week 1&lt;/em&gt;_&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Route Model Binding in Laravel</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Wed, 29 Apr 2020 09:42:01 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/route-model-binding-in-laravel-34ja</link>
      <guid>https://dev.to/bijaykumarpun/route-model-binding-in-laravel-34ja</guid>
      <description>&lt;p&gt;Route Model Binding provides a mechanism to bind/inject a model instance in the route. It's a neat way to validates a model Id injected in the route by injecting a Model instance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Implicit Binding&lt;/strong&gt;&lt;br&gt;
In this method, we directly inject the model instance by passing the type hinted variable as a parameter in the closure. The type hinted variable name should match the route segment name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('api/posts/{post}',function(App\Post $post){
return $post-&amp;gt;title;
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the &lt;code&gt;{post}&lt;/code&gt; URI segment in the URL matches the type hinted &lt;code&gt;$post&lt;/code&gt; variable. &lt;br&gt;
Laravel will then automatically inject the model instance that has an &lt;code&gt;id&lt;/code&gt; field matching the corresponding value from the request URI, i.e &lt;code&gt;{post}&lt;/code&gt;, if not matched a 404 HTTP response will be automatically generated.&lt;/p&gt;

&lt;p&gt;In default case the default column looked for is the &lt;code&gt;id&lt;/code&gt; column but can be changed by using the &lt;code&gt;getRouteKeyName()&lt;/code&gt; Eloquent function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function getRouteKeyName(){
return 'slug';
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the route will have &lt;code&gt;slug&lt;/code&gt; instead of &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explicit Binding&lt;/strong&gt;&lt;br&gt;
In this method, we explicitly bind a model to the segment of the route.&lt;/p&gt;

&lt;p&gt;Explicit binding can be done by using &lt;code&gt;Router::model()&lt;/code&gt; method. This can be used inside &lt;code&gt;boot()&lt;/code&gt; method of &lt;strong&gt;RouterServiceProvider&lt;/strong&gt; class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//RouteServiceProvider.php
public function boot(){
parent::boot();
Route::model('post',App\Post::class);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This bounds all &lt;code&gt;{post}&lt;/code&gt; parameters to the &lt;code&gt;App\Post&lt;/code&gt; model, meaning a &lt;code&gt;Post&lt;/code&gt; model will then be injected in the route.&lt;/p&gt;

&lt;p&gt;The difference between &lt;strong&gt;implicit&lt;/strong&gt; and &lt;strong&gt;explicit&lt;/strong&gt; binding is explicit binding allows putting extra logic.&lt;/p&gt;

&lt;p&gt;Another way of explicit binding is by overriding &lt;code&gt;resolveRouteBinding()&lt;/code&gt; method on the Eloquent model itself.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//App\Post model
public function resolveRouteBinding($value)
{return $this-&amp;gt;where('slug',$value)-&amp;gt;first()??abort(404);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>laravel</category>
      <category>excerpts</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Binding a resource controller in Laravel</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Wed, 29 Apr 2020 02:33:53 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/binding-a-resource-controller-in-laravel-1hmn</link>
      <guid>https://dev.to/bijaykumarpun/binding-a-resource-controller-in-laravel-1hmn</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is resource controller?&lt;/strong&gt;&lt;br&gt;
Laravel has some conventions/rules for all of the routes of a traditional REST/CRUD controller called resource controller. Laravel also comes with a generator out of the box and a convenient route definition that allows binding an entire resource controller at once.&lt;br&gt;
Simply put, resource controller is used when all &lt;strong&gt;CRUD&lt;/strong&gt; operations are performed. Meanwhile, if performed manually, then plain controllers are used.&lt;/p&gt;

&lt;p&gt;To generate recource controller:&lt;br&gt;
&lt;code&gt;php artisan make:controller MySampleResourceController --resource&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Controller Binding&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;// routes/web.php&lt;br&gt;
Route::resource('tasks','TasksController');&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To list all the route:&lt;br&gt;
&lt;code&gt;php artisan route:list&lt;/code&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>beginners</category>
      <category>excerpts</category>
    </item>
    <item>
      <title>Laravel Controllers</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Tue, 28 Apr 2020 15:55:45 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/laravel-controllers-4h1c</link>
      <guid>https://dev.to/bijaykumarpun/laravel-controllers-4h1c</guid>
      <description>&lt;p&gt;&lt;em&gt;Exceprts from the book Laravel: Up and Running by Matt Stauffer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Requests can come to applications not only via routes, but also cron jobs, Artisan command-line calls, queue jobs etc.&lt;br&gt;
Controller's primary job is to capture the intent of an HTTP request and pass it on the rest of the application.&lt;/p&gt;

&lt;p&gt;To create controller, run:&lt;br&gt;
&lt;code&gt;php artisan make:controller &amp;lt;controller-name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This creates a controller class inside &lt;code&gt;app/Http/Controllers/&lt;/code&gt;.&lt;br&gt;
Additionally, the &lt;code&gt;--resource&lt;/code&gt; option can be used to autogenerate methods for basic resource routes like create() and update()&lt;/p&gt;

&lt;p&gt;Artisan's &lt;strong&gt;make&lt;/strong&gt; namespace provides a lot tools for generating skeleton files for a variety of system files.&lt;/p&gt;

&lt;p&gt;A common controller method example:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
//SomeController.php&lt;br&gt;
public function index(){&lt;br&gt;
return view('tasks.index')&lt;br&gt;
-&amp;gt;with('tasks',Tasks:all());&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
The above can be used as:&lt;br&gt;
&lt;code&gt;//route/web.php&lt;br&gt;
Route::get('/','SomeController@index');&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
This loads the &lt;code&gt;resources/views/tasks/index.blade.php&lt;/code&gt; or &lt;code&gt;resources/views/tasks/index.php&lt;/code&gt; and passes it a single variable named &lt;strong&gt;tasks&lt;/strong&gt; which contains the result of the &lt;strong&gt;Task::all()&lt;/strong&gt; Eloquent method. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Subdomain Routing and Namespace Prefixes in Laravel</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Tue, 28 Apr 2020 12:52:51 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/subdomain-routing-and-namespace-prefixes-in-laravel-lc4</link>
      <guid>https://dev.to/bijaykumarpun/subdomain-routing-and-namespace-prefixes-in-laravel-lc4</guid>
      <description>&lt;p&gt;&lt;em&gt;Excerpts from the book Laravel Up and Running by Matt Stauffer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Subdomain routing is like route prefixing yet with scope only within the subdomain.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Two primary uses of subdomain routing&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Present different section of the application to different subdomain&lt;/li&gt;
&lt;li&gt;Set part of the subdomain as parameter&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eg.&lt;br&gt;
&lt;code&gt;Route::group(['domain'=&amp;gt;'api.myapp.com'],function(){&lt;br&gt;
Route::get('/',function(){&lt;br&gt;
//&lt;br&gt;
});&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Route::group('domain'=&amp;gt;{account}.myapp.com'],function(){&lt;br&gt;
Route::get('/',function($account){&lt;br&gt;
//&lt;br&gt;
});&lt;br&gt;
Route::get('users/{id}'function($account,id){&lt;br&gt;
//&lt;br&gt;
});&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The subdomain here is parameterized and &lt;em&gt;will be passed as the first parameter to every grouped routes&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Namespace Prefixes&lt;/strong&gt;&lt;br&gt;
Grouping routes by subdomain mean their controller may have similar PHP namespace.&lt;br&gt;
Eg. for different APIs the namespace can be &lt;code&gt;App\Http\Controllers\API\ControllerA&lt;/code&gt;&lt;br&gt;
and for different subdomains, the namespace can be &lt;code&gt;App\Http\Contollers\account\ControllerB&lt;/code&gt; etc.&lt;/p&gt;

&lt;p&gt;These long controller references can be avoided with namespace prefixes&lt;/p&gt;

&lt;p&gt;Eg.&lt;br&gt;
__//App\Http\Controllers\ControllerA&lt;br&gt;
&lt;code&gt;Route::get('/','ControllerA@index');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Route::group(['namespace'=&amp;gt;'API'],function(){&lt;br&gt;
//App\Http\Controllers\API\ControllerB&lt;br&gt;
&lt;/code&gt;Route::get('api/','ControllerB@index');&lt;br&gt;
});`&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Name Prefix&lt;/strong&gt;&lt;br&gt;
Prefix can also be used for route groups. Route group name prefixes help define that every route within this group should have a given string prefixed to its name.&lt;br&gt;
Ex.&lt;br&gt;
&lt;code&gt;Route::group(['as'=&amp;gt;'users.,'prefix'=&amp;gt;'users'],function(){&lt;br&gt;
ROute::group(['as'=&amp;gt;'comments.,'prefix'=&amp;gt;'comments'],function(){&lt;br&gt;
//Route name will be users.comments.show&lt;br&gt;
Route::get('{id}',function(){&lt;br&gt;
//do something &lt;br&gt;
}}-&amp;gt;name('show');&lt;br&gt;
});&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>beginners</category>
      <category>excerpts</category>
    </item>
    <item>
      <title>Inflating views and passing variable in Laravel</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Tue, 28 Apr 2020 12:48:04 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/inflating-views-and-passing-variable-16j7</link>
      <guid>https://dev.to/bijaykumarpun/inflating-views-and-passing-variable-16j7</guid>
      <description>&lt;p&gt;&lt;em&gt;Excerpts from the book Laravel Up and Running by Matt Stauffer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;View Formats&lt;/strong&gt;&lt;br&gt;
There are two formats of views in Laravel right out of the box:&lt;br&gt;
&lt;strong&gt;example.blade.php&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;example.php&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first one is rendered by the Blade engine, while the latter is rendered by the PHP engine. They both reside in &lt;code&gt;resources/views/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;View Loading Mechanism&lt;/strong&gt;&lt;br&gt;
Three ways to load view;&lt;br&gt;
-view()&lt;br&gt;
-View::make()&lt;br&gt;
-Injecting with Illuminate\View\ViewFactory&lt;/p&gt;

&lt;p&gt;Simple View Usage:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Route::get('/,function(){&lt;br&gt;
return view('home');&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Passing variable to view&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;Route::get('work',function(){&lt;br&gt;
return view('tasks.index')&lt;br&gt;
-&amp;gt;with('tasks',Task::all());&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The above closure loads the &lt;code&gt;resources/views/tasks/index.blade.php&lt;/code&gt; or &lt;code&gt;resources/views/tasks/index.php&lt;/code&gt; view and passes a single variable name &lt;code&gt;tasks&lt;/code&gt; with the result of the result of the &lt;code&gt;Task::all()&lt;/code&gt; eloquent method.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using View Composers to share variables with every view&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;view()-&amp;gt;share('view_variable','view_value');&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>L is for Laravel; Routes</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Tue, 28 Apr 2020 11:23:40 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/l-is-for-laravel-routes-4544</link>
      <guid>https://dev.to/bijaykumarpun/l-is-for-laravel-routes-4544</guid>
      <description>&lt;p&gt;&lt;em&gt;Excerpts from the book Laravel Up and Running by Matt Stauffer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Route naming convention&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;resourcePlural.action&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Eg.&lt;br&gt;
photos.index&lt;br&gt;
photos.create&lt;br&gt;
photos.edit&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Route groups&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Route groups allow grouping several routes together, and apply shared configuration settings&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Defining a route group&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Route::group([],function(){&lt;br&gt;
Route::get('hello',function){&lt;br&gt;
return 'hello';&lt;br&gt;
});&lt;br&gt;
Route::get('world',function(){&lt;br&gt;
return 'world';&lt;br&gt;
});&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Though there is no difference in separating the routes in above group, the square brackets passed as first parameter allows to pass in various configuration that can be applied to the entire route group!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: The function passed in as second parameter above is called closure; Laravel's implementation of anonymous function.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Another use of &lt;em&gt;Route Group&lt;/em&gt; is the use of Middlewares. &lt;br&gt;
Ex. Restricting a group of routes to logged-in users only&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Route::group(['middleware'=&amp;gt;'auth'],function(){&lt;br&gt;
Route::get('dashboard',function(){&lt;br&gt;
return view('dashboard');&lt;br&gt;
});&lt;br&gt;
Route::get('account',function(){&lt;br&gt;
return view('account');&lt;br&gt;
});&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;What above code does is users need to be logged in to the application to view the dashboard or the account page.&lt;/p&gt;

&lt;p&gt;Instead of &lt;em&gt;attaching&lt;/em&gt; middlewares to the &lt;em&gt;routes definition&lt;/em&gt;,it is better to attach directly to the controllers.&lt;/p&gt;

&lt;p&gt;String that is passed in the middleware() method is the middleware, which can me chained with &lt;em&gt;modifier methods&lt;/em&gt; only() and except() to define &lt;em&gt;which method will receive the middleware&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Eg.&lt;br&gt;
&lt;code&gt;class DashboardController extends Controller&lt;br&gt;
{&lt;br&gt;
public function __construct() //constructor method&lt;br&gt;
{&lt;br&gt;
$this-&amp;gt;middleware('auth');&lt;br&gt;
$this-&amp;gt;middleware('admin-auth')-&amp;gt;only('admin'); //or -&amp;gt;except('admin');&lt;br&gt;
}&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Path Prefixes&lt;/strong&gt;&lt;br&gt;
Route groups can also be used to simplify path prefixes.&lt;br&gt;
Eg. if the site's api is prefixed with /api:&lt;br&gt;
&lt;code&gt;Route::group(['prefix'=&amp;gt;'api'],function(){&lt;br&gt;
Route::get('/',function(){&lt;br&gt;
//Handles the path /api&lt;br&gt;
});&lt;br&gt;
Route::get('users',function(){&lt;br&gt;
//Handles the path /api/users&lt;br&gt;
});&lt;br&gt;
});&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: /api represents the root of the prefixed group in above example&lt;/em&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>beginners</category>
      <category>excerpts</category>
    </item>
    <item>
      <title>What's inside /etc/apt/sources.list</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Wed, 22 Apr 2020 17:22:55 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/what-s-inside-etc-apt-sources-list-2h1k</link>
      <guid>https://dev.to/bijaykumarpun/what-s-inside-etc-apt-sources-list-2h1k</guid>
      <description>&lt;p&gt;And also quite possibly inside &lt;code&gt;/etc/apt/sources.list.d/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Upfront, the &lt;code&gt;/etc/apt/source.list&lt;/code&gt; is a configuration file for Linux's Advance Packaging Tool, that holds URLs and other information for remote repositories from where software packages and applications are installed.&lt;br&gt;
Same goes with files inside &lt;code&gt;/etc/apt/sources.list.d/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Basically, when an installation command is executed, eg. &lt;code&gt;apt-get install &amp;lt;package_name&amp;gt;&lt;/code&gt; then the Package Management System looks inside &lt;code&gt;/etc/apt/sources.list&lt;/code&gt; and &lt;code&gt;/etc/apt/sources.list.d/&lt;/code&gt; for the remote repository link, and searches for the desired application to be downloaded.&lt;/p&gt;

&lt;p&gt;" One of the reasons why there are two places for list instead of one, is in order to make sure data are not overwritten/lost during a system update. &lt;code&gt;/etc/apt/source.list&lt;/code&gt; may be overwritten in update as this tend to happen with &lt;code&gt;/etc/profile&lt;/code&gt;. That is also why custom configurations that generally goes inside &lt;code&gt;/etc/profile&lt;/code&gt; file are preferably placed inside &lt;code&gt;/etc/profile.d/&lt;/code&gt; directory. "&lt;/p&gt;

&lt;p&gt;A single link inside &lt;code&gt;/etc/apt/sources.list&lt;/code&gt; file looks like this:&lt;br&gt;
&lt;code&gt;deb-src http://security.ubuntu.com/ubuntu eoan-security universe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On interpreting individual word:&lt;br&gt;
&lt;strong&gt;deb-src&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;debian source files that needs to be compiled. It can also be &lt;strong&gt;deb&lt;/strong&gt;, which means precompiled debian source files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="http://securty.ubuntu.com/ubuntu" rel="noopener noreferrer"&gt;http://securty.ubuntu.com/ubuntu&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The URL where the repository is stored&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;eoan-security&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The version name of the repository&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;universe&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How the software is available to end users&lt;/li&gt;
&lt;li&gt;It can be one of &lt;code&gt;Main&lt;/code&gt;, &lt;code&gt;Restricted&lt;/code&gt;, &lt;code&gt;Universe&lt;/code&gt; or &lt;code&gt;Multiverse&lt;/code&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7v3en0y1daw6hsebdlk1.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall:&lt;br&gt;
&lt;code&gt;deb (or deb-src) address distribution_name package_type_list&lt;/code&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>bash</category>
    </item>
    <item>
      <title>Manually downloading a software package using apt</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Wed, 22 Apr 2020 16:55:02 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/manually-downloading-a-software-package-using-apt-3p2l</link>
      <guid>https://dev.to/bijaykumarpun/manually-downloading-a-software-package-using-apt-3p2l</guid>
      <description>&lt;p&gt;Packages are generally installed with below command:&lt;br&gt;
&lt;code&gt;apt-get install &amp;lt;package_name&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;apt install &amp;lt;package_name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Using the &lt;code&gt;--download-only&lt;/code&gt; option will only download the package and not install it&lt;br&gt;
&lt;code&gt;apt install --download-only &amp;lt;package_name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F71bqwo4pd1cg89426jdv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F71bqwo4pd1cg89426jdv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The downloaded files are inside &lt;code&gt;/var/cache/apt/archives&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The package can then be manually installed with &lt;code&gt;dpkg -i &amp;lt;package_name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Be warned it may cause dependency resolution error for a number of different reason:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;--download-only&lt;/code&gt; option only downloads the package and not the dependencies&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dpkg&lt;/code&gt; can not resolve dependency, which is also why &lt;code&gt;apt&lt;/code&gt; or &lt;code&gt;apt-get&lt;/code&gt; were built on top of it to solve this and some other drawbacks.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>linux</category>
      <category>ubuntu</category>
      <category>bash</category>
    </item>
    <item>
      <title>Ditching apt-get for apt</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Wed, 22 Apr 2020 16:35:07 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/ditching-apt-get-for-apt-5h5h</link>
      <guid>https://dev.to/bijaykumarpun/ditching-apt-get-for-apt-5h5h</guid>
      <description>&lt;p&gt;Well not really ditching, but if we are to believe in linux command manuals, then &lt;code&gt;apt&lt;/code&gt; is being encouraged over &lt;code&gt;apt-get&lt;/code&gt;, not that &lt;code&gt;apt-get&lt;/code&gt; is being deprecated in any sense.&lt;/p&gt;

&lt;p&gt;I like to think of &lt;code&gt;apt&lt;/code&gt; as a churned down version of &lt;code&gt;apt-get&lt;/code&gt; and &lt;code&gt;apt-cache&lt;/code&gt;. I have been regularly using &lt;code&gt;apt-get&lt;/code&gt;. &lt;code&gt;apt-cache&lt;/code&gt;, however, is a different story.&lt;br&gt;
A quick &lt;code&gt;man apt-cache&lt;/code&gt; tells me &lt;code&gt;apt-cache&lt;/code&gt; performs a wide variety of operations on APT's package cache. I know APT stands for Advance Packaging Tool, and is something the debian based linux distros use for compiling and installing software packages. &lt;code&gt;apt-cache&lt;/code&gt;, on further google search, seems to do 'stuffs' with the packages in the &lt;strong&gt;remote&lt;/strong&gt; repository.&lt;/p&gt;

&lt;p&gt;Anyway, &lt;code&gt;apt&lt;/code&gt; has command lines most frequently used in both &lt;code&gt;apt-get&lt;/code&gt; and &lt;code&gt;apt-cache&lt;/code&gt;. &lt;code&gt;apt&lt;/code&gt; tends to make performing task easier for "end users". We can think of &lt;code&gt;apt-cache&lt;/code&gt; and &lt;code&gt;apt-get&lt;/code&gt; as something that works on lower level than &lt;code&gt;apt&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Again, point to note is that &lt;code&gt;apt-cache&lt;/code&gt; and &lt;code&gt;apt-get&lt;/code&gt; are like the front end to the debian's &lt;code&gt;dpkg&lt;/code&gt; tool, which is the core tool of the Package Management System. The &lt;code&gt;dpkg&lt;/code&gt; tool can, however, only work with locally existing software packages. It means it cannot itself download software packages from remote repositories. To overcome this, we have many other tools built on top of &lt;code&gt;dpkg&lt;/code&gt;, out of which, and not very surprisingly, &lt;code&gt;apt-get&lt;/code&gt; and &lt;code&gt;apt-cache&lt;/code&gt; are some of those. And when &lt;code&gt;apt-get&lt;/code&gt; and &lt;code&gt;apt-cache&lt;/code&gt; are again 'combined' in a sense, we get &lt;code&gt;apt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aYOevc4U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2wfsk15qism8jfymswey.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aYOevc4U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2wfsk15qism8jfymswey.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>bash</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Linux shells: interactive/non-interactive, login and non-login</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Tue, 21 Apr 2020 17:31:17 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/linux-shells-interactive-non-interactive-login-and-non-login-2ddp</link>
      <guid>https://dev.to/bijaykumarpun/linux-shells-interactive-non-interactive-login-and-non-login-2ddp</guid>
      <description>&lt;p&gt;Courtesy of &lt;strong&gt;chaos&lt;/strong&gt; at Stack Exchange&lt;br&gt;
Link:&lt;br&gt;
&lt;a href="https://unix.stackexchange.com/questions/170493/login-non-login-and-interactive-non-interactive-shells"&gt;https://unix.stackexchange.com/questions/170493/login-non-login-and-interactive-non-interactive-shells&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;login shell: A login shell logs you into the system as a specific user, necessary for this is a username and password. When you hit ctrl+alt+F1 to login into a virtual terminal you get after successful login: a login shell (that is interactive). Sourced files:
    /etc/profile and ~/.profile for Bourne compatible shells (and /etc/profile.d/*)
    ~/.bash_profile for bash
    /etc/zprofile and ~/.zprofile for zsh
    /etc/csh.login and ~/.login for &lt;/li&gt;
&lt;li&gt;&lt;p&gt;non-login shell: A shell that is executed without logging in, necessary for this is a current logged in user. When you open a graphic terminal in gnome it is a non-login (interactive) shell. Sourced files:&lt;br&gt;
    /etc/bashrc and ~/.bashrc for &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;interactive shell: A shell (login or non-login) where you can interactively type or interrupt commands. For example a gnome terminal (non-login) or a virtual terminal (login). In an interactive shell the prompt variable must be set ($PS1). Sourced files:&lt;br&gt;
    /etc/profile and ~/.profile&lt;br&gt;
    /etc/bashrc or /etc/bash.bashrc for &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;non-interactive shell: A (sub)shell that is probably run from an automated process you will see neither input nor output when the calling process don't handle it. That shell is normally a non-login shell, because the calling user has logged in already. A shell running a script is always a non-interactive shell, but the script can emulate an interactive shell by prompting the user to input values. Sourced files:&lt;br&gt;
    /etc/bashrc or /etc/bash.bashrc for bash (but, mostly you see this at the beginning of the script: [ -z "$PS1" ] &amp;amp;&amp;amp; return. That means don't do anything if it's a non-interactive shell).&lt;br&gt;
    depending on shell; some of them read the file in the $ENV variable.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Linux Test Session: $PATH</title>
      <dc:creator>Bijay Kumar Pun</dc:creator>
      <pubDate>Tue, 21 Apr 2020 17:22:05 +0000</pubDate>
      <link>https://dev.to/bijaykumarpun/linux-test-session-path-154g</link>
      <guid>https://dev.to/bijaykumarpun/linux-test-session-path-154g</guid>
      <description>&lt;p&gt;To know pathname of file or link that is executed in current environment, use &lt;strong&gt;which&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D6p-83Li--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/goge1wt5t7kt69hpsomc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D6p-83Li--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/goge1wt5t7kt69hpsomc.png" alt="Alt Text" width="439" height="89"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  To add a path variable use &lt;strong&gt;export&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---asLmsD2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ye49ws12stxbss0nl7vw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---asLmsD2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ye49ws12stxbss0nl7vw.png" alt="Alt Text" width="726" height="179"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;we can also use . to add the current directory path to the PATH variable&lt;br&gt;
$&lt;code&gt;export PATH=$PATH:.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Path variable can both be prepended or appended, and they are separated by &lt;strong&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All changes, however, is temporary. These path variables are deleted when the user signs out, or when the shell is closed.&lt;/p&gt;

&lt;p&gt;To make this permanent, the export command needs to be executed every time the system boots. This can be done in two distinct ways:&lt;/p&gt;

&lt;h3&gt;
  
  
  1.Via existing files:
&lt;/h3&gt;

&lt;p&gt;when we login to the linux system, the login shell looks for five different startup files to process the commands from.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;/etc/profile&lt;br&gt;
(for login shell)&lt;br&gt;
The main and the default startup file&lt;br&gt;
All users execute this file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;$HOME/.bash_profile &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;$HOME/.bash_login&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;$HOME/.profile &lt;br&gt;
(interactive shell doesn't process .profile file)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;$HOME/.bashrc&lt;br&gt;
(for interactive shell)&lt;br&gt;
This is run from one of the other above three files&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When one of the above four files is encountered, it is executed first, while any file after that is ignored!&lt;/p&gt;

&lt;h3&gt;
  
  
  2.Via creating a new .sh file
&lt;/h3&gt;

&lt;p&gt;Create a new .sh file inside /etc/profile.d/ with the export command. This file is executed every time /etc/profile is executed. One advantage of adding an environment variable this way is data will not be lost when system is updated. Eg. /etc/profile may be reset during system update.&lt;/p&gt;

&lt;p&gt;Finally, execute &lt;em&gt;source&lt;/em&gt; command to make the changes apparent to the current shell.&lt;br&gt;
Eg.&lt;br&gt;
&lt;code&gt;source ~/.bash_profile&lt;/code&gt;&lt;br&gt;
&lt;code&gt;source ~/.bashrc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Bash shell can be started in three ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;default login shell at login time&lt;/li&gt;
&lt;li&gt;Interactive shell that is started by spawning a subshell&lt;/li&gt;
&lt;li&gt;Non-interactive shell to run a script&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
  </channel>
</rss>
