Laravel Tips ‘N Tricks

Laravel hidden features and snippets

Latest articles

Conditional Eloquent Where Clauses

Hi there, I didn’t wrote for a while, but today I find a very good Laravel Eloquent feature to work with – Conditional Clauses. Think of each Eloquent model as a powerful query builder allowing you to fluently query the database table associated with the model. So, basically you can use every Query Builder methods in your Eloquent model. You can...

Laravel array validation unique values

Laravel now have ability to check if validation array have only unique values. It’s very helpful if you want to ensure that user enters only unique values. In this example we ensure that user create tasks with different titles. $validator = Validator::make($request->all(), [ 'task.*.title' => 'required|distinct', ...

First Laravel packages in your new project

When I start new project, I install these packages all the time. 1. Laravel IDE Helper 2.Laravel Collective – HTML Everybody loves this package. Why? 3 words – Form Model Binding. No screenshots, no comments. You know how it works. 3.Doctrine DBAL This package allow you to rename and change column type using laravel migrations. Schema::table('users',...

Laravel Notifications

Notification package Laravel 5 This one is awesome. Painless notifications in your application. How I use it? In my master blade template I just put notifications printing code: @notification() Then in my controllers I can send notifications to blade views like this: \Notification::success('User Updated Successfully'); But… I’m lazy...

Laravel Debugbar

Laravel Debugbar One more must have package in dev environment. Track application load speed, database queries, ajax responses and so on. If you want to guarantee that it not shows in production: app/Providers/AppServiceProvider.php /** * Register any application services. * * @return void */ public function...

Laravel Slack

maknz/slack This is tool allowing you to send messages to your team slack channel. I like it to catch production errors. So from now all your team will know about errors first. app/Exceptions/Handler.php /** * Report or log an exception. * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. ...

Laravel Log Viewer

Laravel 5 log viewer This is must have package in dev environment. You can easy analyse laravel log files without opening them in ugly command line. Event better it have datatables implemented, so you can use search, ordering and so on and so on. The post Laravel Log Viewer appeared first on Laravel Tips 'N Tricks.

Laravel IDE Helper

Laravel IDE Helper Awesome package to help Phpstorm autocomplete everything. Even facades. Even controller actions. The post Laravel IDE Helper appeared first on Laravel Tips 'N Tricks.

Laravel Smoke testing

Smoke tests ensure you that laravel boots correctly and all pages are loaded. You can even check if text in your page matches what are you hope for. It’s extremely easy to write these tests and when you change something in your code, you know that you don’t leave some dd(), exit or something you use just for debug. You already have your first smoke...

Laravel $request->get() vs. $request->input()

Just say you have form with inputs: <form> <input name="items[category][item1]"> <input name="items[category][item2]"> <input name="items[category][item3]"> </form> With get: $request->get('items')['category']['item1']; With input: $request->input('items.category.item1'); ...

Discover, share and read the best on the web

Subscribe to RSS Feeds, Blogs, Podcasts, Twitter searches, Facebook pages, even Email Newsletters! Get unfiltered news feeds or filter them to your liking.

Get Inoreader
Inoreader - Subscribe to RSS Feeds, Blogs, Podcasts, Twitter searches, Facebook pages, even Email Newsletters!