<?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>Bhaskar Chaudhary &#8211; MaXEster Technologies  | Technical Blog</title>
	<atom:link href="https://www.maxester.com/blog/author/mightyrusher/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>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>Get a string after a specific substring by length in MySQl and SQL</title>
		<link>https://www.maxester.com/blog/2019/11/28/get-a-string-after-a-specific-substring-by-length-in-mysql-and-sql/</link>
		<comments>https://www.maxester.com/blog/2019/11/28/get-a-string-after-a-specific-substring-by-length-in-mysql-and-sql/#respond</comments>
		<pubDate>Thu, 28 Nov 2019 07:14:35 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=748</guid>
		<description><![CDATA[<p>For MySql Let us assume a Customers table with a CustomerName Column which contain string of Max Length 200. For Sql Server Let us assume a Customers table with a CustomerName Column which contain string of Max Length 200.</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/28/get-a-string-after-a-specific-substring-by-length-in-mysql-and-sql/">Get a string after a specific substring by length in MySQl and SQL</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p></p>



<p></p>



<h4>For MySql</h4>



<p>Let us assume a <code>Customers</code> table with a <code>CustomerName</code> Column which contain string of Max Length 200. </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>//Column data

+-----+---------------------------------------------+
| id  | CustomerName                                |
+-----+---------------------------------------------+
| 1   | Alfreds Futterkiste                         |
| 2   | Ana Trujillo Emparedados y helados          |
| 3   | Antonio Moreno Taquería                     |
| 4   | Around the Horn                             |
| 5   | Berglunds snabbköp                          |
| 6   | Blauer See Delikatessen                     |
| 7   | Blondel père et fils                        |
| 8   | Bólido Comidas preparadas                   |
+-----+---------------------------------------------+</code></pre>



<pre class="wp-block-code"><code>SELECT
  CONCAT (
    SUBSTR(`Customers`.`CustomerName`, 1, 15),
    IF(
      LENGTH(`Customers`.`CustomerName`) > 15,
      '...',
      ''
    )
  ) as `name`
FROM
  `Customers`;</code></pre>



<pre class="wp-block-code"><code>//output

+-----+---------------------------------------------+
| id  | CustomerName                                |
+-----+---------------------------------------------+
| 1   | Alfreds Futterk...                          |
| 2   | Ana Trujillo Em...                          |
| 3   | Antonio Moreno ...                          |
| 4   | Around the Horn                             |
| 5   | Berglunds snabb...                          |
| 6   | Blauer See Deli...                          |
| 7   | Blondel père et...                          |
| 8   | Bólido Comidas ...                          |
+-----+---------------------------------------------+</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>




<h4>For Sql Server</h4>



<p>

Let us assume a <code>Customers</code> table with a <code>CustomerName</code> Column which contain string of Max Length 200. 

</p>



<pre class="wp-block-code"><code>//Column data

+-----+---------------------------------------------+
| id  | CustomerName                                |
+-----+---------------------------------------------+
| 1   | Alfreds Futterkiste                         |
| 2   | Ana Trujillo Emparedados y helados          |
| 3   | Antonio Moreno Taquería                     |
| 4   | Around the Horn                             |
| 5   | Berglunds snabbköp                          |
| 6   | Blauer See Delikatessen                     |
| 7   | Blondel père et fils                        |
| 8   | Bólido Comidas preparadas                   |
+-----+---------------------------------------------+</code></pre>



<pre class="wp-block-code"><code>SELECT
  SUBSTRING(CustomerName, 1, 15) + (
    CASE WHEN LEN(CustomerName) > 15 THEN '...' ELSE '' END
  )
FROM
  Customers;
</code></pre>



<pre class="wp-block-code"><code>//output

+-----+---------------------------------------------+
| id  | CustomerName                                |
+-----+---------------------------------------------+
| 1   | Alfreds Futterk...                          |
| 2   | Ana Trujillo Em...                          |
| 3   | Antonio Moreno ...                          |
| 4   | Around the Horn                             |
| 5   | Berglunds snabb...                          |
| 6   | Blauer See Deli...                          |
| 7   | Blondel père et...                          |
| 8   | Bólido Comidas ...                          |
+-----+---------------------------------------------+</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/28/get-a-string-after-a-specific-substring-by-length-in-mysql-and-sql/">Get a string after a specific substring by length in MySQl and SQL</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/28/get-a-string-after-a-specific-substring-by-length-in-mysql-and-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Capitalize First Letter Of Each Word In Js ?</title>
		<link>https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/</link>
		<comments>https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/#respond</comments>
		<pubDate>Thu, 21 Nov 2019 15:25:28 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=741</guid>
		<description><![CDATA[<p>By using function: &#8220;replace()&#8221; is a iterative function calling a regex as first parameter and adding callback function as its second parameter we can achieve this. Regular Expression for Every Word in a String ( /\w\S*/g ) And Callback function&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/" 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/21/how-to-capitalize-first-letter-of-each-word/">How To Capitalize First Letter Of Each Word In Js ?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>By using function:</p>



<p>&#8220;replace()&#8221; is a iterative function calling a regex as first parameter and  adding callback function as its second parameter we can achieve this.</p>



<p>Regular Expression for Every Word in a String ( /\w\S*/g )</p>



<p>And</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>Callback function converts first word of every word to Upper case</p>



<pre class="wp-block-code"><code>var text = "how to capitalize first letter of each word in js ?";

function toTitleCase(str) {
    return str.replace(/\w\S*/g, function(txt){
        return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    });
}

text = toTitleCase(text);

//output
//How To Capitalize First Letter Of Each Word In Js ?</code></pre>



<p>For es6:</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>var text = "how to capitalize first letter of each word in js ?";

upperCaseWords = (s => s.toLowerCase().split(" ").map(s => s.charAt(0).toUpperCase() + s.substring(1)).join(" "));
    
text = upperCaseWords(text)

//output
//How To Capitalize First Letter Of Each Word In Js ?</code></pre>



<p></p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/21/how-to-capitalize-first-letter-of-each-word/">How To Capitalize First Letter Of Each Word In Js ?</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/21/how-to-capitalize-first-letter-of-each-word/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic web form validation with predefined rules and messages</title>
		<link>https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/</link>
		<comments>https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/#respond</comments>
		<pubDate>Sat, 16 Nov 2019 13:45:17 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=735</guid>
		<description><![CDATA[<p>Sometimes when we are using same validation rules for a form in different location with different ID&#8217;s. To prevent repeating the code and make it more maintainable we define it as a function in one place. That is what this&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/" 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/16/dynamic-web-form-validation-with-predefined-rules-and-messages/">Dynamic web form validation with predefined rules and messages</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 when we are using same validation rules for a form in different location with different ID&#8217;s.</p>



<p>To prevent repeating the code and make it more maintainable we define it as a function in one place.</p>



<p>That is what this blog is about.</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>Prerequisite </strong></p>



<ul><li> <strong>jQuery</strong> </li><li> <strong>jQuery Validation Plugin</strong> </li></ul>



<p>

Create a js file

</p>



<pre class="wp-block-code"><code>var $postJobValidation = {
	id: function(e) {
		$("#" + e).validate({
			rules: this.rules,
			messages: this.messages
		})
	},
	set: function(e) {

		if (e) {
			for (t in e) {

				if (e[t].rule)
					this.rules[t] = e[t].rule

				if (e[t].message)
					this.messages[t] = e[t].message
			}
		}
	},
	rules: {
		name: "required",
		email: {
			email: !0,
			required: !0
		},
	},
	messages: {
		name: "PLease Enter Your Name",
		email: {
			email: "Enter Valid Email!",
			required: "Enter Email!"
		},
	}
};</code></pre>



<p>To validate a form with id &#8220;<strong>form1</strong>&#8221; and having fiels name and email.</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>$formValidation.id("form1")</code></pre>



<p>To add rules and message we just need to edit <strong>rules </strong>and <strong>message </strong>object in <strong>$formValidation</strong></p>



<pre class="wp-block-code"><code>$postJobValidation.set({
	"contact": {
		rule: "required",
		message: "Please Enter Your Contact"
	}
})</code></pre>



<p>Set function iterates through the json provided and adding  rules</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/16/dynamic-web-form-validation-with-predefined-rules-and-messages/">Dynamic web form validation with predefined rules and messages</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/16/dynamic-web-form-validation-with-predefined-rules-and-messages/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>How To print \n in C?</title>
		<link>https://www.maxester.com/blog/2019/11/05/how-to-print-n-in-c/</link>
		<comments>https://www.maxester.com/blog/2019/11/05/how-to-print-n-in-c/#respond</comments>
		<pubDate>Tue, 05 Nov 2019 14:05:37 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=718</guid>
		<description><![CDATA[<p>As We know \n is used for new line Similarly \t for vertical tab so to print \n just add \ before \n like \\n similarly for \t it will be \\t</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/05/how-to-print-n-in-c/">How To print \n in C?</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>As We know \n is used for new line</p>



<p>Similarly \t for vertical tab </p>



<p>so to print \n just add \ before \n like \\n</p>



<p>similarly for \t it will be \\t</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>#include &lt;iostream>

using namespace std;

int main()
{
    cout&lt;&lt;"Hello \\n World";

    return 0;
}

//output
Hello \n World  </code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/05/how-to-print-n-in-c/">How To print \n in C?</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/05/how-to-print-n-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Json parsing to add an  iterating element by Jquery</title>
		<link>https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/</link>
		<comments>https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/#respond</comments>
		<pubDate>Mon, 04 Nov 2019 09:34:21 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=715</guid>
		<description><![CDATA[<p>To reduce load time and improve user experience we use ajax to get add new element to existing html. let the response be: let the response is saved in var response let the place where response is appended is to&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/" 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/04/json-parsing-to-add-an-iterating-element-by-jquery/">Json parsing to add an  iterating element by Jquery</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 reduce load time and improve user experience we use ajax to get add new element to existing html.</p>



<p>let the response be:</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>[{
    "data1": "male",
    "data2": "23",
    "data3": "Delhi",
    "data4": "10+2 or above"
}, {
    "data1": "male",
    "data2": "40",
    "data3": "Delhi",
    "data4": "Diploma"
}, {
    "data1": "male",
    "data2": "31",
    "data3": "Delhi",
    "data4": "Graduation"
}, {
    "data1": "male",
    "data2": "25",
    "data3": "Delhi",
    "data4": "Post Graduation"
}]</code></pre>



<p style="text-align:left">let the response is saved in <strong>var  response </strong></p>



<p>let the place where response is appended is </p>



<pre class="wp-block-code"><code>&lt;div>&lt;table id="append">&lt;/table>&lt;/div></code></pre>



<p>to append the json store in data to &#8220;#append&#8221;</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>$("#append").append(response.map(data => `&lt;tr>&lt;td>${data.data1}&lt;/td>&lt;td>${data.data2}&lt;/td>&lt;td>${data.data3}&lt;/td>&lt;td>${data.data4}&lt;/td>&lt;/tr>`))</code></pre>



<p>Jquery append function is an iterative function which will call <strong>response.map</strong> which will call parse json</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/11/04/json-parsing-to-add-an-iterating-element-by-jquery/">Json parsing to add an  iterating element by Jquery</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/04/json-parsing-to-add-an-iterating-element-by-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a DB in MongoDB</title>
		<link>https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/</link>
		<comments>https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/#respond</comments>
		<pubDate>Tue, 22 Oct 2019 03:41:27 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=711</guid>
		<description><![CDATA[<p>It is as simple as calling an URL If you have already installed MongoDB. If Not go-ahead download from here</p>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/">Creating a DB in MongoDB</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>It is as simple as calling an URL</p>



<p>If you have already installed MongoDB.</p>



<p>If Not go-ahead download from <a href="https://www.mongodb.com/download-center">here  </a></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>var MongoClient = require('mongodb').MongoClient;
//Create a database named "testdb":
var url = "mongodb://localhost:27017/testdb";

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  console.log("Database created!");
  db.close();
});</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/22/creating-a-db-in-mongodb/">Creating a DB in MongoDB</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/22/creating-a-db-in-mongodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Node Event Module</title>
		<link>https://www.maxester.com/blog/2019/10/22/node-event-module/</link>
		<comments>https://www.maxester.com/blog/2019/10/22/node-event-module/#respond</comments>
		<pubDate>Tue, 22 Oct 2019 01:21:39 +0000</pubDate>
		<dc:creator><![CDATA[Bhaskar Chaudhary]]></dc:creator>
				<category><![CDATA[JS]]></category>
		<category><![CDATA[Node Js]]></category>

		<guid isPermaLink="false">https://www.maxester.com/blog/?p=707</guid>
		<description><![CDATA[<p>Node has a concept of event-driven programming, in which code is written to react rather than be called. Node has an inbuilt event module about which you learn in-depth from here, we will use event listener and event emitter method&#8230;</p>
<p><a href="https://www.maxester.com/blog/2019/10/22/node-event-module/" 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/22/node-event-module/">Node Event Module</a> appeared first on <a rel="nofollow" href="https://www.maxester.com/blog">MaXEster Technologies  | Technical Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[
<p>Node has a concept of event-driven programming, in which code is written to <strong>react</strong> rather than be <strong>called</strong>. </p>



<p>Node has an inbuilt event module about which you learn in-depth from <a href="https://nodejs.org/api/events.html">here</a>, we will use event listener and event emitter method of this class.</p>



<pre class="wp-block-code"><code>const EventEmitter = require('events');

const event = new EventEmitter();</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><strong>Event Listener</strong></p>



<p>An event listener is a logic which will be executed when an event is emitted. Make sure you have declared Event listener before emitting the event.</p>



<pre class="wp-block-code"><code>event.on('some-event', function() {
  // some logic
});


//es6
event.on('some-event', () => {
  // some logic
});


//with parameter
event.on('some-event', (parameter) => {
  // some logic
});</code></pre>



<p><strong>Event Emitter</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>




<p>Event emitter is used to trigger a specific event listener.</p>



<pre class="wp-block-code"><code>
event.emit('some-event', parameter);</code></pre>
<p>The post <a rel="nofollow" href="https://www.maxester.com/blog/2019/10/22/node-event-module/">Node Event Module</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/22/node-event-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
