Laravel Popular Post


Laravel 5 - Create modular structure application example using L5Modular package

Today i am going to share with you how to implement modular design in your laravel application from scratch using L5Modular package. When i have started working with laravel and i see the structure of laravel like controller, views, model and helpers etc. I was impressed and i liked more. But still i was little bit confuse, thinking we can make it modular then it become more useful and understandable. If you create module for every crud enter level like country, state, city, item, product etc. It could be fantastic because it can re-use in your other laravel application easily. Modular struct.....

By Hardik Savani | June 20, 2017 | | 4095 Viewer | Category : Laravel
READ MORE

How to get current url with parameters in Laravel 5?

We sometimes require to get full url path with query string parameters that way we can perform on it. So we can get current url with also all parameter using several method of laravel. There are several option to get full url with query string as listed bellow: <ul> <li><strong>URL Facade</strong></li> <li><strong>Request Facade</strong></li> <li><strong>$request Object</strong></li> </ul> I give you three way to get full path with parameters, so you can see as bellow: <strong>Example 1:</strong> <pre class="prettyprint lang-php"> public function index() { $fullURL = \URL::full(); p.....

By Hardik Savani | August 8, 2016 | | 4064 Viewer | Category : Laravel
READ MORE

How to use foreach object in Nodejs ?

Normally, we does use foreach loop in PHP, JS etc, but when i was working on socket programming at that time i require to use foreach of object in server.js. I did also search on google and try to how to use foreach in Node JS. At last i found to use forEach and solve it. so, let's see following example. <strong >Example</strong> <pre class="prettyprint lang-php"> socket.on("newmessage", function(obj) { obj = JSON.parse(obj); obj.forEach(function(items) { console.log(items.userid); var e = "notify-"+items.userid; io.sockets.emit(e, 1); }); }); </pre>

By Hardik Savani | March 31, 2016 | | 4041 Viewer | Category : Laravel
READ MORE

How to execute artisan commands from route or controller in Laravel ?

Sometimes we require to run php artisan command from route or controller file in out Laravel Application, However we can do it using Artisan facade. Laravel Artisan facade that way we can easily run all artisan command with argument. Artisan facade have two method call() and queue(), queue() through we can simply make process in queue like email sending etc. So let's see simple example with route. In this example we run "php artisan migrate" command using artisan facade. Here i bellow example you can learn how you can run artisan commands from route. <strong>Example:</strong> <pre class="pre.....

By Hardik Savani | February 12, 2017 | | 4029 Viewer | Category : Laravel
READ MORE

How to redirect to external link with laravel 5?

Sometimes you may need to redirect on external URL from our laravel 5 application like if you use something like Amazon API, Paypal API etc. so, Laravel 5 provide away() for redirect other external link for return redirect like bellow example: <strong>Example:</strong> <pre class="prettyprint lang-php"> return redirect()->away('http://www.google.com'); </pre>

By Hardik Savani | May 9, 2016 | | 3987 Viewer | Category : Laravel
READ MORE

How to get current controller name in view Laravel 5?

If you require to get current controller name in your view file or in your middleware or your serviceprovider etc. you can get your controller details from current route like UserController, HomeController ect. you can also get full path of controller file. Laravel getAction() through we can get whole array of current route details, in this example i get current controller in my auth middleware, if you require on your view file or other place then you can simply get. So, let's see example how you can get controller name in auth middleware. <strong>Example: app/Http/Middleware/Authenticate.p.....

By Hardik Savani | July 27, 2016 | | 3938 Viewer | Category : Laravel
READ MORE

How to check column exists or not in table Laravel 5

When i was working my laravel application at that time i need to remove column from database. But i am not sure that column is exists or not in tables. So i was thinking, but i found solution from Laravel Database Migration Schema. we can check column is exists or not in tabales using hasColumn. If you also need to remove if column is exists then you can use bellow example. <strong>Example:</strong> <pre class="prettyprint lang-php"> if (Schema::hasColumn('subscriptions', 'stripe_id')) { Schema::table('subscriptions', function ($table) { $table->dropColumn('stripe_id'); }); } <.....

By Hardik Savani | May 4, 2016 | | 3804 Viewer | Category : Laravel
READ MORE

How to get months difference between two dates in laravel?

Whenever you need to get difference between two dates in months in laravel 5 then you can get easily using Carbon. Laravel by default provide Carbon class. Carbon class throught you can calculate difference between two dates in months. In Following example you can see, we have a two dates, first $to variable and second one $from variable. Carbon class diffInMonths function using you can get difference between two dates. I hope you will find your solution. <strong>Example:</strong> <pre class="language-php"> $to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', '2015-5-5 3:30:34'); $from = \C.....

By Hardik Savani | February 6, 2016 | | 3792 Viewer | Category : Laravel
READ MORE

Solved - gulp error cannot find module laravel-elixir

If you also find error like "laravel-elixir not found" on gulp then you can install laravel-elixir npm package manually. I also fetch this error when i was new in laravel and working with gulp first time. We can solve laravel-elixir not found error using laravel-elixir nodejs package. So you can run just bellow command and check. First command if you run already then don't require to run. <strong>Command:</strong> <pre class="prettyprint lang-php"> npm install npm install laravel-elixir </pre>

By Hardik Savani | July 22, 2016 | | 3758 Viewer | Category : Laravel
READ MORE

How to get soft deleted records in Laravel 5?

Laravel 5 Eloquent provide soft deleted feature is awesome that way laravel excluded all soft delete record. So By default Laravel Eloquent excludes all the soft deleted records from query results. But you can get also soft deleted record using withTrashed() of Laravel Eloquent. It will return all record from table. <pre> Item::withTrashed()->get(); </pre> You can get only soft deleted row using onlyTrashed() of Laravel Eloquent. <pre> Item::onlyTrashed()->get(); </pre>

By Hardik Savani | June 24, 2016 | | 3748 Viewer | Category : Laravel
READ MORE


    Laravel 5.3 - Customize pagination templates example from scratch

    Laravel 5.3 - Customize pagination templates example from scratch

    Open Post

    How to send mail using mailable in laravel 5.3?

    How to send mail using mailable in laravel 5.3?

    Open Post

    Laravel 5.3 - import export csv and excel file into database

    Laravel 5.3 - import export csv and excel file into database

    Open Post

    How to create quick apache virtual host in Ubuntu?

    How to create quick apache virtual host in Ubuntu?

    Open Post

    Laravel 5 - "syntax error or access violation 1055 in group by" Solved

    Laravel 5 - "syntax error or access violation 1055 in group by" Solved

    Open Post

    Laravel 5 - Grayscale Image Generate Example from scratch

    Laravel 5 - Grayscale Image Generate Example from scratch

    Open Post