<?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; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/category/laravel/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxester.com/blog</link>
	<description>Tutorials, Examples and Implementation code for Developers Help</description>
	<lastBuildDate>Mon, 17 Feb 2025 09:17:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.22</generator>
	<item>
		<title>404 page not found in Laravel</title>
		<link>https://www.maxester.com/blog/2020/08/20/in-laravel-you-can-easily-add-404-page-because-laravel-already-has-404-functionality/</link>
		<comments>https://www.maxester.com/blog/2020/08/20/in-laravel-you-can-easily-add-404-page-because-laravel-already-has-404-functionality/#respond</comments>
		<pubDate>Thu, 20 Aug 2020 15:31:08 +0000</pubDate>
		<dc:creator><![CDATA[Maxester]]></dc:creator>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[404 Page In Laravel]]></category>
		<category><![CDATA[Custom 404 Page in Laravel]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=1042</guid>
		<description><![CDATA[<p>In Laravel you can easily add 404 page because Laravel already has 404 functionality. What you have to do You have to creates a new folder &#8220;errors&#8221; in resources/views/ After that create a file name 404.blade.php and put in to&#8230;</p>
<p><a href="https://www.maxester.com/blog/2020/08/20/in-laravel-you-can-easily-add-404-page-because-laravel-already-has-404-functionality/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/08/20/in-laravel-you-can-easily-add-404-page-because-laravel-already-has-404-functionality/">404 page not found in Laravel</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>In Laravel you can easily add 404 page because Laravel already has 404 functionality. </p>



<p>What you have to do </p>



<p>You have to creates a new folder &#8220;errors&#8221; in resources/views/</p>



<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>



<p>After that create a file name 404.blade.php and put in to this new folder</p>



<p>Now its look like this<br>
/resouces/views/errors/404.blade.php</p>



<p>You can add as per design in this 404 page you want.</p>



<center>
<script async="" src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads" style="display:inline-block;" data-ad-client="ca-pub-3804472713147276" data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>



<figure class="wp-block-image"><img src="https://www.maxester.com/blog/wp-content/uploads/2020/08/laravel-error.jpg" alt="" class="wp-image-1043" srcset="https://www.maxester.com/blog/wp-content/uploads/2020/08/laravel-error.jpg 989w, https://www.maxester.com/blog/wp-content/uploads/2020/08/laravel-error-300x170.jpg 300w, https://www.maxester.com/blog/wp-content/uploads/2020/08/laravel-error-768x434.jpg 768w" sizes="(max-width: 989px) 100vw, 989px" /></figure>



<p>Now you can check by entering any wrong work in your website URL this 404 page will come.</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/08/20/in-laravel-you-can-easily-add-404-page-because-laravel-already-has-404-functionality/">404 page not found in Laravel</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2020/08/20/in-laravel-you-can-easily-add-404-page-because-laravel-already-has-404-functionality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Manual login user by Email Id in Laravel.</title>
		<link>https://www.maxester.com/blog/2020/01/01/manual-login-user-by-email-in-laravel/</link>
		<comments>https://www.maxester.com/blog/2020/01/01/manual-login-user-by-email-in-laravel/#respond</comments>
		<pubDate>Wed, 01 Jan 2020 08:35:50 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=808</guid>
		<description><![CDATA[<p>This blog is to help you manually login by using a URL with get parameters. As this practice is not secured and can be taken advantage by hackers so use it on your own risk. To make it a bit&#8230;</p>
<p><a href="https://www.maxester.com/blog/2020/01/01/manual-login-user-by-email-in-laravel/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/01/01/manual-login-user-by-email-in-laravel/">Manual login user by Email Id in Laravel.</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>This blog is to help you manually login by using a URL with get parameters.</p>



<p>As this practice is not secured and can be taken advantage by hackers so use it on your own risk.</p>



<p>To make it a bit difficult for them we can ask for primary key and other parameters to ensure some sort of validation.</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p><strong>Auth::login($user)&nbsp;</strong> is used to manually login the user. Where <strong>$user</strong> is the eloquent collection response of user table</p>



<pre class="wp-block-code"><code>public function userManualLogin(Request $request)
{
   $user = User::where('email', $request->email)->first();

	//any form of validation in if clause

	if ($user->id == $request->id) {
		Auth::login($user);
		return redirect('/user/dashboard');
	}

	if ($this->hasTooManyLoginAttempts($request)) {
	$this->fireLockoutEvent($request);

	return $this->sendLockoutResponse($request);
	}

	$this->incrementLoginAttempts($request);

	return $this->sendFailedLoginResponse($request);
}</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2020/01/01/manual-login-user-by-email-in-laravel/">Manual login user by Email Id in Laravel.</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2020/01/01/manual-login-user-by-email-in-laravel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to merge Collection in Laravel?</title>
		<link>https://www.maxester.com/blog/2019/12/19/how-to-merge-collection-in-laravel/</link>
		<comments>https://www.maxester.com/blog/2019/12/19/how-to-merge-collection-in-laravel/#respond</comments>
		<pubDate>Thu, 19 Dec 2019 11:29:28 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=804</guid>
		<description><![CDATA[<p>To merge two collection col1 and col2 we use merge() method of collection OR We can just pass those collection while declaring the collection Some Example case Sometimes we need to get different collection from same Database Table depending on&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/12/19/how-to-merge-collection-in-laravel/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/12/19/how-to-merge-collection-in-laravel/">How to merge Collection in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>To merge two collection col1 and col2 we use merge() method of collection</p>



<pre class="wp-block-code"><code>$collection = collect();
$collection->merge(['col1' => $col1, 'col2' => $col2 ]);</code></pre>



<p>OR</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>We can just pass those collection while declaring the collection</p>



<pre class="wp-block-code"><code>$collection = collect([
        'col1' => $col1,
        'col2' => $col2
    ]);</code></pre>



<p>Some Example case</p>



<p>Sometimes we need to get different collection from same Database Table depending on a particular column but we don&#8217;t know the no of collections</p>



<p>Then we merge those collection together in a parent collection.</p>



<p>So for e.g. we need users by different city </p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>// this data source can be a static array 
// or a dynamic collection
$states = [
            'Delhi', 
            'Tamil Nadu', 
            'Uttar Pradesh', 
            'Haryana', 'Maharashtra', 
            'Punjab', 
            'Rajasthan', 
            'Bihar'
        ];

// collection helper used to define new Collection
$stateUser = collect();

foreach ($states as $state)
{
    // getting user by a particular city with status 1
    $data = DB::table('user')
        ->select('user.*')
        ->where("user.city", $state)
        ->where('user.status', 1)
        ->get();

    // merging the collection by the key name of state 
    // if collection is not empty
    if (!empty($data[0])) 
    $stateUser = $stateUser->merge([$state => $data]);
}
</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/12/19/how-to-merge-collection-in-laravel/">How to merge Collection in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/12/19/how-to-merge-collection-in-laravel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Facades in Laravel</title>
		<link>https://www.maxester.com/blog/2019/11/11/custom-facades-in-laravel/</link>
		<comments>https://www.maxester.com/blog/2019/11/11/custom-facades-in-laravel/#respond</comments>
		<pubDate>Mon, 11 Nov 2019 13:38:12 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=721</guid>
		<description><![CDATA[<p>Facades are static interface of a class to encapsulate its default arguments. First we need to define a class in app directory like app/CustomClass/NewClass.php Now we need to define a facade for this class Firstly we need to edit AppServiceProvider.php&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/11/11/custom-facades-in-laravel/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/11/custom-facades-in-laravel/">Custom Facades in Laravel</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Facades are static interface of a class to encapsulate its default arguments.</p>



<p>First we need to define a class in app directory</p>



<p>like <strong>app/CustomClass/NewClass.php</strong></p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>&lt;?php
namespace App\CustomClass;

class NewClass
{
    public function __construct(variable1)
    {
        $this->variable1 = $variable1; 
    }
    public function yourMethod(Request $request)
    {
        //code
        return "something";
    }
}</code></pre>



<p>Now we need to define a facade for this class</p>



<p>Firstly we need to edit <strong>AppServiceProvider.php</strong></p>



<p>In <strong>app/Providers/AppServiceProvider.php </strong></p>



<p>Use class defined in app directory</p>



<pre class="wp-block-code"><code>use App\CustomClass\NewClass;</code></pre>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>Add following to <strong>boot </strong>method</p>



<pre class="wp-block-code"><code>$this->app->singleton("NewClassFacade", function(){
    return new NewClass('in');
});</code></pre>



<p> insert <strong>NewClassFacade.php</strong> in app directory</p>



<pre class="wp-block-code"><code>&lt;?php

namespace App;

class NewClassFacade
{
    protected static function resolveFacade($name)
    {
        return app()[$name];
    }
    
    public static function __callStatic($method, $arguments)
    {
        return (self::resolveFacade('NewClassFacade'))
            ->$method(...$arguments);
    }
}</code></pre>



<p>To call the facade:</p>



<p>Just add the facade to your controller</p>



<pre class="wp-block-code"><code>use App\NewClassFacade;</code></pre>



<p>And call facade like any static method</p>



<pre class="wp-block-code"><code>$output = NewClassFacade::yourMethod();</code></pre>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/11/custom-facades-in-laravel/">Custom Facades in Laravel</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/11/11/custom-facades-in-laravel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are Laravel View Composer?</title>
		<link>https://www.maxester.com/blog/2019/10/03/what-are-laravel-view-composer/</link>
		<comments>https://www.maxester.com/blog/2019/10/03/what-are-laravel-view-composer/#respond</comments>
		<pubDate>Thu, 03 Oct 2019 04:56:18 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=680</guid>
		<description><![CDATA[<p>Sometimes we need to pass similar type of data to different view files or partials and later changing them is a pain point as you have to change every single one of them, hence to fix this issue view composers&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/10/03/what-are-laravel-view-composer/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/03/what-are-laravel-view-composer/">What are Laravel View Composer?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Sometimes we need to pass similar type of data to different view files or partials and later changing them is a pain point as you have to change every single one of them, hence to fix this issue view composers are used.</p>



<p>First we have to open <strong>AppServiceProvider.php</strong> in <strong>app/Providers.</strong></p>



<p>Add View facade to the service provider</p>



<pre class="wp-block-code"><code>use Illuminate\Support\Facades\View;</code></pre>



<p>After adding View Facade add composer code to boot function</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>function boot()
{
       View::composer('page.index', function($view){
            $view->with('data', 'Value This could output of eloquent too')
        });
}</code></pre>



<p><strong>NOTE:</strong> </p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<ul><li><strong>page.index</strong> is the location of targeted blade file in view folder</li><li>You can also use wildcard to target all blade file in a directory (<strong>page.*</strong>)</li><li>To target more than one file you can pass array instead of string. </li></ul>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/03/what-are-laravel-view-composer/">What are Laravel View Composer?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/10/03/what-are-laravel-view-composer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add Helper file in Laravel?</title>
		<link>https://www.maxester.com/blog/2019/08/20/how-to-add-helper-file-in-laravel/</link>
		<comments>https://www.maxester.com/blog/2019/08/20/how-to-add-helper-file-in-laravel/#respond</comments>
		<pubDate>Tue, 20 Aug 2019 12:19:27 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=621</guid>
		<description><![CDATA[<p>To create custom helpers.php file in laravel we need to edit composer.json file in laravel. In autoload object add the following file array:- After adding this we need to run the following command Make sure composer is installed. This will&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/08/20/how-to-add-helper-file-in-laravel/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/20/how-to-add-helper-file-in-laravel/">How to add Helper file in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>To create custom helpers.php file in laravel we need to edit composer.json file in laravel.</p>



<p>In <strong>autoload</strong> object add the following <strong>file </strong>array:-</p>



<pre class="wp-block-code"><code>"autoload": {
    "files": [
        "app/helpers.php"
    ]
},</code></pre>



<p>After adding this we need to run the following command Make sure composer is installed.</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>composer dump-autoload</code></pre>



<p>This will create a <strong>helpers.php</strong> file in your <strong>app </strong>folder. Which will be accessed by all controllers and view files.</p>



<p>Best way to add a function in your Helper file is to check if  it already exist or not</p>



<pre class="wp-block-code"><code>&lt;?php
if (! function_exists('your_custom_helper')) {
function your_custom_helper($string) {
   // your code
}
}</code></pre>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/20/how-to-add-helper-file-in-laravel/">How to add Helper file in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/08/20/how-to-add-helper-file-in-laravel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Laravel Group routing</title>
		<link>https://www.maxester.com/blog/2019/08/13/laravel-group-routing/</link>
		<comments>https://www.maxester.com/blog/2019/08/13/laravel-group-routing/#respond</comments>
		<pubDate>Tue, 13 Aug 2019 14:20:13 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=616</guid>
		<description><![CDATA[<p>For common prefixes in a url, Laravel uses url grouping. In the above route addresses abc.com/my-profile In GET and POST method you can use print GET route as :- And, POST route as:-</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/13/laravel-group-routing/">Laravel Group routing</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>For common prefixes in a url, <strong>Laravel </strong>uses url grouping.</p>



<pre class="wp-block-code"><code>Route::group(['prefix'=>'user','as'=>'user.'], function(){

	Route::get('my-profile', 
	['as' => 'profile', 
	'uses' => 'UserController@myProfile']
	);

	Route::post('my-profile', 
	['as' => 'putprofile', 
	'uses' => 'UserController@putMyProfile']);

});</code></pre>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>In the above route addresses </p>



<p><strong>abc.com/my-profile</strong></p>



<p>In <strong>GET </strong>and <strong>POST </strong>method</p>



<p>you can use print GET route as :-</p>



<pre class="wp-block-code"><code>route(user.profile)</code></pre>



<p>And, POST route as:-</p>



<pre class="wp-block-code"><code>route(user.putprofile)</code></pre>



<p> </p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/13/laravel-group-routing/">Laravel Group routing</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/08/13/laravel-group-routing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cache Clear in Laravel</title>
		<link>https://www.maxester.com/blog/2019/08/03/cache-clear-in-laravel/</link>
		<comments>https://www.maxester.com/blog/2019/08/03/cache-clear-in-laravel/#respond</comments>
		<pubDate>Sat, 03 Aug 2019 11:02:01 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=612</guid>
		<description><![CDATA[<p>Laravel supports popular caching backends like Memcached and Redis out of the box. There are 4 types of Cache in Laravel which you can clear by cli:- Application Cache Route Cache Config Cache View Cache If you are using Shared&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/08/03/cache-clear-in-laravel/" class="btn-more">Read More<span class="arrow-more">&#8594;</span></a></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/03/cache-clear-in-laravel/">Cache Clear in Laravel</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Laravel supports popular caching backends like <a href="https://memcached.org">Memcached</a> and <a href="https://redis.io">Redis</a> out of the box.</p>



<p>There are 4 types of <strong>Cache</strong> in Laravel which you can clear by cli:-</p>



<ul><li><strong>Application Cache</strong> </li></ul>



<pre class="wp-block-code"><code>php artisan cache:clear</code></pre>



<ul><li><strong>Route Cache</strong></li></ul>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>php artisan route:cache</code></pre>



<ul><li><strong>Config Cache</strong></li></ul>



<pre class="wp-block-code"><code>php artisan config:cache</code></pre>



<ul><li><strong>View Cache</strong></li></ul>



<pre class="wp-block-code"><code>php artisan view:clear</code></pre>



<p>If you are using Shared Hosting you can run the command out of cli<br></p>



<pre class="wp-block-code"><code>Route::get('/clear-cache', function() {
    Artisan::call('cache:clear');
    // you can use other cache cleaning commands too
    return "cache:clear";
});</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/08/03/cache-clear-in-laravel/">Cache Clear in Laravel</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/08/03/cache-clear-in-laravel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a csv file in Laravel?</title>
		<link>https://www.maxester.com/blog/2019/07/24/how-to-create-a-csv-file-in-laravel/</link>
		<comments>https://www.maxester.com/blog/2019/07/24/how-to-create-a-csv-file-in-laravel/#comments</comments>
		<pubDate>Wed, 24 Jul 2019 15:22:25 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=593</guid>
		<description><![CDATA[<p>Declare Header Declare Columns Get data Set Formatted data to a variable Return response Your code should look like this</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/24/how-to-create-a-csv-file-in-laravel/">How to create a csv file in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Declare Header </p>



<pre class="wp-block-code"><code>$headers = array(
	"Content-type" => "text/csv",
	"Content-Disposition" => "attachment; filename=theincircle_csv.csv",
	"Pragma" => "no-cache",
	"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
	"Expires" => "0"
	);</code></pre>



<p>Declare Columns</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>$columns = array(
		'Name', 
		'Mobile', 
		'Email', 
		'Gender',
		'City', 
		'Location',
		'Skills', 
		'Salary', 
		'Experience'
	);</code></pre>



<p>Get data</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>$users = User::where('user.status',1)
		->select( 
			'users.name',
			'users.contact',
			'users.email',
			'users.gender',
			'users.salary',
			'users.exp'
			)
		->limit(5
		)->get();</code></pre>



<p>Set Formatted data to a variable</p>



<pre class="wp-block-code"><code>$callback = function() use ($users, $columns, $skill)
			{
	$file = fopen('php://output', 'w');
	fputcsv($file, $columns);

	foreach($users as $user) {
	fputcsv($file, array(
			$user->name,
			$user->contact,
			$user->email,
			$user->gender,
			$user->city_name,
			$user->location_name,
			$user->skill, 
			$user->salary, 
			$user->exp
		));
	
	}
	fclose($file);
	};</code></pre>



<p>Return response</p>



<pre class="wp-block-code"><code>return Response::stream($callback, 200, $headers);</code></pre>



<p>Your code should look like this</p>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<pre class="wp-block-code"><code>$headers = array(
	"Content-type" => "text/csv",
	"Content-Disposition" => "attachment; filename=theincircle_csv.csv",
	"Pragma" => "no-cache",
	"Cache-Control" => "must-revalidate, post-check=0, pre-check=0",
	"Expires" => "0"
				);

$users = User::where('user.status',1)
		->select( 
			'users.name',
			'users.contact',
			'users.email',
			'users.gender',
			'users.salary',
			'users.exp'
			)
		->limit(5
		)->get();

$columns = array(
		'Name', 
		'Mobile', 
		'Email', 
		'Gender',
		'City', 
		'Location',
		'Skills', 
		'Salary', 
		'Experience'
	);

$callback = function() use ($users, $columns, $skill)
			{
	$file = fopen('php://output', 'w');
	fputcsv($file, $columns);

	foreach($users as $user) {
	fputcsv($file, array(
			$user->name,
			$user->contact,
			$user->email,
			$user->gender,
			$user->city_name,
			$user->location_name,
			$user->skill, 
			$user->salary, 
			$user->exp
		));
	
	}
	fclose($file);
	};

return Response::stream($callback, 200, $headers);</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/24/how-to-create-a-csv-file-in-laravel/">How to create a csv file in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/07/24/how-to-create-a-csv-file-in-laravel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to send SMTP mail with Attachments in Laravel?</title>
		<link>https://www.maxester.com/blog/2019/07/23/how-to-send-smtp-mail-with-attachments-in-laravel/</link>
		<comments>https://www.maxester.com/blog/2019/07/23/how-to-send-smtp-mail-with-attachments-in-laravel/#respond</comments>
		<pubDate>Tue, 23 Jul 2019 13:07:56 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Laravel]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=591</guid>
		<description><![CDATA[<p>Firstly get the extension of the file to send and get the MIME TYPE for it. Use the mail function and pass the required data needed by the layout and SMTP connection protocol.</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/23/how-to-send-smtp-mail-with-attachments-in-laravel/">How to send SMTP mail with Attachments in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Firstly get the extension of the file to send and get the MIME TYPE for it.</p>



<pre class="wp-block-code"><code>$data['filename'] = Auth::User()->file;

$extension = explode('.',Auth::User()->file)[1];

if ($extension == 'doc') {

	$data['mine_type'] = 'application/msword';

}
elseif ($extension == 'docx') {

	$data['mine_type'] = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';

}
elseif ($extension == 'pdf') {

	$data['mine_type'] = 'application/pdf';
	
}</code></pre>



<center>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Fads -->
<ins class="adsbygoogle fads"
     style="display:inline-block;"
     data-ad-client="ca-pub-3804472713147276"
     data-ad-slot="1267368188"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>




<p>Use the mail function and pass the required data needed by the layout and SMTP connection protocol.</p>



<pre class="wp-block-code"><code>Mail::send('emails_layout',$data, function ($message) use ($data) {

	$message->from('noreply@maxester.com', 'MaXEster');

	$message->to($data['email'])->subject('Find the attachment');

	$message->attach(
		$data['pathToFile'], array(
	    'as' => $data['filename'], 
	    'mime' => $data['mine_type'])
		);

});</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/07/23/how-to-send-smtp-mail-with-attachments-in-laravel/">How to send SMTP mail with Attachments in Laravel?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.maxester.com/blog/2019/07/23/how-to-send-smtp-mail-with-attachments-in-laravel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
