Laravel Popular Post


How to resolve - No supported encrypter found. The cipher and / or key length are invalid. in Laravel 5

I did get "No supported encrypter found. The cipher and / or key length are invalid" error when i clone my laravel project. But when i run project on browser i was getting this error i did try to solve this error, finally i found bellow error you can generate application key by using bellow command: <strong>Run Command:</strong> <pre class="prettyprint lang-php"> php artisan key:generate </pre>

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

How to set global view variables using composer share in Laravel 5?

Everyone will have same situation sometimes, like we have some information that we need to access in all view files for example site title, login user information, footer information etc. But, we can define global view variables using composer() of Laravel. We just have to define value in AppServiceProvider and we can access that variable in every blade files. In bellow example i set "siteTitle" variable as global and i can access that variable in every view files. You have to just open <strong class="path">AppServiceProvider.php</strong> and we can set variable as like bellow: <strong>app/.....

By Hardik Savani | July 8, 2016 | | 1023 Viewer | Category : Laravel
READ MORE

Laravel 5 - where condition with two columns example code

Laravel 5 introduce whereColumn() in Query Builder, that way we can compare two column like simple where condition. We sometimes require to check this type of condition. In this example code, i have simple "items" table and i want to get only created_at and updated_at column should equals. So you can also check bellow laravel eloquent as bellow: <strong>Example:</strong> <pre class="prettyprint lang-php"> $data = DB::table("items") ->whereColumn('created_at','updated_at') ->get(); print_r($data); </pre> <strong>Example 2:</strong> <pre class="prettyprint lang-php"> .....

By Hardik Savani | July 29, 2016 | | 1021 Viewer | Category : Laravel
READ MORE

How to count number of files in folder and remove all files in folder example in Laravel 5 ?

you are working on laravel framwork and you want to count how many image or files in folder and print of front then you can do with laravel "File" class.you can also count in core PHP by using glob() but if you are working on laravel then you have to use 'File' class library and it is easy and more flexible to use. If you also want to remove all the files Or images in specific folder then you can delete by using "File" class function. sometimes we need to delete files in the folder. that way: <pre class="language-php"> use Input; use File; class HomeController extends AdminController { .....

By Hardik Savani | January 13, 2016 | | 1009 Viewer | Category : Laravel
READ MORE

How to get size of directory in MB Laravel 5?

Mostly we require to calculate for uploaded directory size because we can see how much we size allocate in uploaded directory. If you have limited server then you always need to check how much size of data in my folder. You can also get size of directory that way you can also display on your admin panel. Laravel provide File facade. File facade through we can get folder size in kb or mb or gb etc. In bellow example i have <strong class="path">images directory</strong> in public folder. so we can get size for images folder like this way : <strong>Example:</strong> <pre class="prettyprint la.....

By Hardik Savani | July 23, 2016 | | 1002 Viewer | Category : Laravel
READ MORE

Laravel where clause with date_format() example

In this post, i share with you that how to use date_format() with where condition of Laravel query builder. When i was working on my project, i require to search with get only selected month and year records from created_at(timestamp) column. I was thinking how can i but i know date_format() of mysql. but don't know how to use in laravel where clause. At last i use DB::raw() of Laravel and it's work. If you have also need to search this way then you can do it this way: <strong>Example:</strong> <pre class="prettyprint lang-php"> $data = DB::table("items") ->select("id","title","creat.....

By Hardik Savani | June 22, 2016 | | 977 Viewer | Category : Laravel
READ MORE

Fixed - MassAssignmentException in model.php laravel 5?

massassignmentexception is for the security purpose if laravel 5 function. When i did start Laravel 5 and first i did try to add user using "User::create(['name'=>'hd','password'=>'1w'])" then i found bellow error. I was thinking what was wrong, but after investigation i found it for our security purpose, because you have to add field name that you want to insert that way other Http script or hacker etc can't insert something elelse you need to add $fillable variable in your Model. So, let's see user model example. <strong>User.php</strong> <pre class="prettyprint lang-php"> namespace App; <br.....

By Hardik Savani | April 25, 2016 | | 976 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 | | 970 Viewer | Category : Laravel
READ MORE

How to send mail using zoho smtp server in PHP Laravel?

Laravel is a very popular and best framework in PHP. Laravel provide several mail drivers like smtp, mail, sendmail, mailgun, mandrill etc. We can also send mail using zoho smtp. I already post send mail using gmail, mailgun etc. Laravel gives us very simple configuration for mail send. So we can simply setup zoho server details. We have to just setup detail for host, post, driver and encryption. You have to follow this link for mail sending, You have to just change, .env file. First just follow this link. <a class="post-link" href="http://itsolutionstuff.com/post/how-to-send-mail-example-in.....

By Hardik Savani | December 22, 2016 | | 969 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 | | 960 Viewer | Category : Laravel
READ MORE


    Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo

    Laravel 5 Autocomplete using Bootstrap Typeahead JS Example with Demo

    Open Post

    How to create middleware for XSS protection in laravel 5?

    How to create middleware for XSS protection in laravel 5?

    Open Post

    Laravel 5 Instagram API tutorial with example

    Laravel 5 Instagram API tutorial with example

    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 call AngularJS controller function in Jquery?

    How to call AngularJS controller function in Jquery?

    Open Post

    Laravel 5.3 new feature and update - $loop variable

    Laravel 5.3 new feature and update - $loop variable

    Open Post