<?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 Archives - Cody Paste</title>
	<atom:link href="https://www.codypaste.com/category/laravel/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.codypaste.com/category/laravel/</link>
	<description>THE WEB PLAYGROUND</description>
	<lastBuildDate>Thu, 25 Apr 2024 11:04:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.codypaste.com/wp-content/uploads/2022/12/cropped-codypaste-32x32.png</url>
	<title>Laravel Archives - Cody Paste</title>
	<link>https://www.codypaste.com/category/laravel/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>View/Template in Laravel and load assets files css, js, images etc and external template like Header and Footer</title>
		<link>https://www.codypaste.com/view-template-in-laravel-and-load-assets-files-css-js-images-etc-and-external-template-like-header-and-footer/</link>
					<comments>https://www.codypaste.com/view-template-in-laravel-and-load-assets-files-css-js-images-etc-and-external-template-like-header-and-footer/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 29 Mar 2023 06:09:39 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=971</guid>

					<description><![CDATA[<p>&#8216;resources\views&#8217; folder is for all templates with the extension .blade.php (e.g. xyz.blade.php) .blade is the template of laravel. &#160; Include external file like header or footer in your template: [crayon-699f8a311c0c7620276435/] &#8216;layout.header&#8217; : layout is folder name (&#8216;resources/views/layout&#8217;) , header is file name (&#8216;resources/views/layout/header.blade.php&#8217;) &#160; Path and location of assets file like css, js, images: All &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/view-template-in-laravel-and-load-assets-files-css-js-images-etc-and-external-template-like-header-and-footer/" class="more-link">read more<span class="screen-reader-text"> "View/Template in Laravel and load assets files css, js, images etc and external template like Header and Footer"</span></a></p>
<p>The post <a href="https://www.codypaste.com/view-template-in-laravel-and-load-assets-files-css-js-images-etc-and-external-template-like-header-and-footer/">View/Template in Laravel and load assets files css, js, images etc and external template like Header and Footer</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>&#8216;resources\views&#8217;</strong> folder is for all templates with the extension .blade.php (e.g. <span style="color: #008000;"><em>xyz.blade.php</em></span>) .blade is the template of laravel.</p>
<p>&nbsp;</p>
<h2><strong>Include external file like header or footer in your template:</strong></h2>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">@include('layout.header')</pre><p><strong>&#8216;layout.header&#8217; : <span style="color: #008000;"><em>layout</em> </span></strong>is folder name <em>(&#8216;resources/views/layout&#8217;)</em> , <strong><span style="color: #008000;"><em>header</em></span> </strong>is file name <em>(&#8216;resources/views/layout/header.blade.php&#8217;)</em></p>
<p>&nbsp;</p>
<h2><strong>Path and location of assets file like css, js, images:</strong></h2>
<p>All assets files should be under the <strong>public</strong> folder, so I created a folder under <strong>public</strong> <em>(public/assets)</em> and kept my files in this folder. (You can create as many folder structures as you want under the public folder).</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;link rel="stylesheet" href="{{ URL::asset('assets/css/style.css') }}"&gt;</pre><p></p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;script src="{{ URL::asset('assets/js/custom.js') }}"&gt;&lt;/script&gt;</pre><p></p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;img src="{{ URL::asset('assets/images/logo-w.png') }}" class="img-fluid" alt=""&gt;</pre><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/view-template-in-laravel-and-load-assets-files-css-js-images-etc-and-external-template-like-header-and-footer/">View/Template in Laravel and load assets files css, js, images etc and external template like Header and Footer</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/view-template-in-laravel-and-load-assets-files-css-js-images-etc-and-external-template-like-header-and-footer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Controller in Laravel</title>
		<link>https://www.codypaste.com/controller-in-laravel/</link>
					<comments>https://www.codypaste.com/controller-in-laravel/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 29 Mar 2023 05:52:17 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=967</guid>

					<description><![CDATA[<p>Create controller file &#8216;app/Http/Controllers/ProductController.php&#8216; and paste the given code below [crayon-699f8a311cd78650624492/] public function index() and public function detail($id) are methods you can remove these method and write your own. in detail($id) method you can see select query with multiple where clause in laravel.</p>
<p>The post <a href="https://www.codypaste.com/controller-in-laravel/">Controller in Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Create controller file &#8216;<span style="color: #008000;"><em>app/Http/Controllers/ProductController.php</em></span>&#8216; and paste the given code below</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php

namespace App\Http\Controllers;

use DB;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class ProductController extends BaseController
{
    public function index(){
		$products = DB::table('products')
				-&gt;selectRaw('*')
				-&gt;where('status', '=', 1)
				//-&gt;where('id', '=', $id)				
				-&gt;get();
		
		return view("products/productList",compact('products'));
	}

	public function detail($id){		
		$products = DB::table('products')
				-&gt;selectRaw('*')
				-&gt;where('status', '=', 1)
				-&gt;where('id', '=', $id)				
				-&gt;get();
		
		return view("products/productDetail",compact('products'));		
	}
}</pre><p><span style="color: #008000;"><em>public function index()</em></span> and <span style="color: #008000;"><em>public function detail($id)</em></span> are methods you can remove these method and write your own.</p>
<p>in <span style="color: #008000;"><em>detail($id)</em></span> method you can see select query with multiple where clause in laravel.</p>
<p>The post <a href="https://www.codypaste.com/controller-in-laravel/">Controller in Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/controller-in-laravel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Route in Laravel</title>
		<link>https://www.codypaste.com/route-in-laravel/</link>
					<comments>https://www.codypaste.com/route-in-laravel/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 29 Mar 2023 05:43:10 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=964</guid>

					<description><![CDATA[<p>In the Laravel route there are 2 ways: Direct load view file from the route, No need to go to controller. Go to the Controller and perform the operation then load the view file. [crayon-699f8a311d099491242217/] Here you can see the &#8216;resources/views/welcome.blade.php&#8217; file load directly. &#160; [crayon-699f8a311d0a2825166607/] url route to method of controller. &#8216;product/{id}&#8217; : url &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/route-in-laravel/" class="more-link">read more<span class="screen-reader-text"> "Route in Laravel"</span></a></p>
<p>The post <a href="https://www.codypaste.com/route-in-laravel/">Route in Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the Laravel route there are 2 ways:</p>
<ol>
<li>Direct load view file from the route, No need to go to controller.</li>
<li>Go to the Controller and perform the operation then load the view file.</li>
</ol>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Route::get('/', function () {
    return view('welcome');
});</pre><p>Here you can see the &#8216;resources/views/welcome.blade.php&#8217; file load directly.</p>
<p>&nbsp;</p><pre class="urvanov-syntax-highlighter-plain-tag">Route::match(['get', 'post'], 'product', 'ProductController@index');
Route::match(['get', 'post'], 'product/{id}', 'ProductController@detail');</pre><p>url route to method of controller.</p>
<p><strong>&#8216;product/{id}&#8217;</strong> : url with parameter</p>
<p><strong>&#8216;ProductController@detail&#8217;</strong> : <span style="color: #008000;"><em>ProductController</em> </span>is controller and <span style="color: #008000;"><em>detail</em> </span>is method</p>
<p>The post <a href="https://www.codypaste.com/route-in-laravel/">Route in Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/route-in-laravel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Remove public from url in Laravel</title>
		<link>https://www.codypaste.com/remove-public-from-url-in-laravel/</link>
					<comments>https://www.codypaste.com/remove-public-from-url-in-laravel/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Sat, 25 Mar 2023 11:52:14 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=958</guid>

					<description><![CDATA[<p>STEP 1 : Check root folder for  server.php, if there is no any server.php just create one with given code below: [crayon-699f8a311d34e642708274/] &#160; &#160; STEP 2: If you want to remove public from url, just create .htaccess in the root folder (where the app, public etc) and paste code below. [crayon-699f8a311d356891480777/] &#160;</p>
<p>The post <a href="https://www.codypaste.com/remove-public-from-url-in-laravel/">Remove public from url in Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><strong>STEP 1 :</strong></h2>
<p>Check root folder for  server.php, if there is no any server.php just create one with given code below:</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell &lt;taylor@laravel.com&gt;
 */

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? ''
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' &amp;&amp; file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

require_once __DIR__.'/public/index.php';</pre><p>&nbsp;</p>
<p>&nbsp;</p>
<h2><strong>STEP 2:</strong></h2>
<p>If you want to remove public from url, just create .htaccess in the root folder (where the app, public etc) and paste code below.</p><pre class="urvanov-syntax-highlighter-plain-tag">&lt;IfModule mod_rewrite.c&gt;
    &lt;IfModule mod_negotiation.c&gt;
        Options -MultiViews
    &lt;/IfModule&gt;

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1 

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php
&lt;/IfModule&gt;</pre><p>&nbsp;</p>
<p>The post <a href="https://www.codypaste.com/remove-public-from-url-in-laravel/">Remove public from url in Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/remove-public-from-url-in-laravel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Start with Laravel</title>
		<link>https://www.codypaste.com/start-with-laravel/</link>
					<comments>https://www.codypaste.com/start-with-laravel/?noamp=mobile#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Sat, 25 Mar 2023 11:23:42 +0000</pubDate>
				<category><![CDATA[Laravel]]></category>
		<guid isPermaLink="false">https://www.codypaste.com/?p=955</guid>

					<description><![CDATA[<p>Introduction and requirements for laravel. For starting the project on laravel we need 3 things to be installed in our system. Composer Use E:\xampp8\php\php.exeforcomposer PHP path. Node and NPM. if you are using XAMPP (e.g. E:\xampp8\php\php.exe) for composer php path :  For Windows, in case you&#8217;re using a locale development environment like XAMPP, just locate &#8230; </p>
<p class="link-more"><a href="https://www.codypaste.com/start-with-laravel/" class="more-link">read more<span class="screen-reader-text"> "Start with Laravel"</span></a></p>
<p>The post <a href="https://www.codypaste.com/start-with-laravel/">Start with Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Introduction and requirements for laravel.</p>
<p>For starting the project on laravel we need 3 things to be installed in our system.</p>
<ol>
<li><a href="https://getcomposer.org/" target="_blank" rel="noopener">Composer</a><br />
Use <span style="color: #008000;"><em>E:\xampp8\php\php.exeforcomposer PHP path.</em></span></li>
<li><a href="https://nodejs.org/" target="_blank" rel="noopener">Node and NPM</a>.</li>
<li><span style="color: #008000;"><em>if you are using XAMPP (e.g. E:\xampp8\php\php.exe) for composer php path : </em></span><br />
<span style="color: #008000;"><em>For Windows, in case you&#8217;re using a locale development environment like XAMPP, just locate the php.ini file (C:\xampp\php in my case), open it and remove the semicolon from the following line.<br />
</em></span><br />
<pre class="urvanov-syntax-highlighter-plain-tag">;extension=zip</pre><br />
<span style="color: #008000;"><em>Restart your Apache webserver and it will work fine.</em></span></p>
<p>&nbsp;</li>
<li>Laravel (open command prompt :- W+R, cmd | Type <strong><em>composer global require &#8220;laravel/installer&#8221;</em></strong> and press enter).</li>
</ol>
<p>Install and check Node &amp; NPM first.</p>
<p>Let&#8217;s Start with creating the first project.</p>
<ol>
<li>Go to <strong>RUN (W+R)</strong> and type <em><strong>cmd</strong></em>.</li>
<li>Type the path of the folder where you want to create a project, We are using xampp so we will Type &#8216;<em><strong>cd xampp/htdcos/mylaravel</strong></em>&#8216; and press Enter.<br />
(<em>mylaravel is a folder which i created under htdocs</em>).</li>
<li>create project<br />
<pre class="urvanov-syntax-highlighter-plain-tag">laravel new example-app</pre><br />
&#8216;example-app&#8217; is name of project. This command will take some time and will install laravel project under &#8216;mylaravel&#8217; folder with the name of &#8216;example-app&#8217;.</li>
</ol>
<p>you can see folder structure under example-app like this:</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-956" src="https://www.codypaste.com/wp-content/uploads/2023/03/laravel-folder-structure.jpg" alt="" width="656" height="550" srcset="https://www.codypaste.com/wp-content/uploads/2023/03/laravel-folder-structure.jpg 656w, https://www.codypaste.com/wp-content/uploads/2023/03/laravel-folder-structure-300x252.jpg 300w" sizes="(max-width: 656px) 100vw, 656px" /></p>
<p>&nbsp;</p>
<p>now open url on your browser and click on &#8216;<strong>public</strong>&#8216; folder. here you can see laravel is intalled successfully.</p>
<p>Now the question is why we clicked on &#8216;<strong>public</strong>&#8216; folder to view our project? so, if you want to avoid &#8216;public&#8217; from URL and want to run project without public in url, you have to override this from .htaccess.</p>
<h4><span style="font-size: 24pt;"><a href="https://www.codypaste.com/remove-public-from-url-in-laravel/" target="_blank" rel="noopener"><strong>How to remove public from url in laravel?</strong></a></span></h4>
<p>The post <a href="https://www.codypaste.com/start-with-laravel/">Start with Laravel</a> appeared first on <a href="https://www.codypaste.com">Cody Paste</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.codypaste.com/start-with-laravel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
