Most voted questions in Laravel

0 votes
1 answer

How to create Eloquent model with relationship?

Hello @kartik, First, you have to create relation ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
340 views
0 votes
1 answer

How to use withErrors with Exception error messages in Laravel?

Hello @kartik, Try this: return Redirect::to('admin/users/create') ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
4,394 views
0 votes
1 answer

How can I clear the cache in laravel using command line?

Hello @kartik, cache:clear artisan command does calls flush function on current ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
1,839 views
0 votes
1 answer

Why to use DB::raw inside DB::select in Laravel?

Hello @kartik, DB::raw() is used to make arbitrary SQL ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
3,856 views
0 votes
1 answer

How do you add headers to a response with a middleware?

Hello @kartik, Using the response helper. use Illuminate\Http\RedirectResponse; $response = $next($request); $response = ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
3,205 views
0 votes
1 answer

How do I get raw form data in laravel?

Hii @kartik, Laravel intercepts all input. If you're ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
4,254 views
0 votes
1 answer

How to get image from resources in Laravel?

Hello @kartik, You can make a route specifically ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
8,406 views
0 votes
1 answer

How to have one-time push in laravel blade?

Hii @kartik,  Extend Blade by creating a push once directive as ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
2,680 views
0 votes
1 answer

How to run laravel 5.0 project on localhost without use php artisan serve?

Hello @kartik, You need to change "server.php" to ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
1,949 views
0 votes
1 answer

How can I implement single table inheritance using Laravel's Eloquent?

Hello @kartik, Global Scope is available: class Article extends Post { ...READ MORE

Oct 23, 2020 in Laravel by Niroj
• 82,880 points
2,206 views
0 votes
1 answer

How to invalidate all tokens for an user in laravel passport?

Hello @kartik, One of the methods it provides ...READ MORE

Oct 23, 2020 in Laravel by Niroj
• 82,880 points
4,322 views
0 votes
1 answer

How can I access my Laravel app from another PC?

Hello @kartik, Use: sudo php artisan serve --host 192.168.1.101 ...READ MORE

Oct 23, 2020 in Laravel by Niroj
• 82,880 points
3,831 views
0 votes
1 answer

Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

Hello @kartik, set MAIL_ENCRYPTION= in .env file. and it worked fine ...READ MORE

Oct 23, 2020 in Laravel by Niroj
• 82,880 points
1,176 views
0 votes
1 answer

How throw forbidden exception from middleware in laravel5?

Hello @kartik, You can simply use the abort() helper. (Or App::abort()) public ...READ MORE

Oct 23, 2020 in Laravel by Niroj
• 82,880 points
4,993 views
0 votes
1 answer

How do I get a “select count(*) group by” using laravel eloquent?

Hello @kartik, You could use this: $reserves = DB::table('reserves')->selectRaw('*, ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
34,241 views
0 votes
1 answer

Fatal error: Class 'App\Http\Controllers\Redirect' not found

Hello @kartik, The only thing that you have ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
5,762 views
0 votes
1 answer

How to Select Certain Fields in Laravel Eloquent?

Hello @kartik, lists() turns the resulting collection into an ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
3,812 views
0 votes
1 answer

How to refer laravel csrf field inside a vue template?

Hello @kartik, If you have the token in ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
2,730 views
0 votes
1 answer

How to gett selected values from a multiple select form in Laravel?

Hello @kartik, First, if you want to have ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
6,906 views
0 votes
1 answer

How to remove Parameter From All Request Objects at Controller Level?

Hello @kartik, First arrange for the middleware to ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
5,362 views
0 votes
1 answer

How to test POST routes in Laravel?

Hello @kartik, You could try this: public function testStoreAction() { ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
2,803 views
0 votes
1 answer

How to compare two encrypted(bcrypt) password in laravel?

Hello @kartik, You can simply use Hash::check() method eg: if(Hash::check('plain-text', $hashedPassword)) ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
4,956 views
0 votes
1 answer

How to include csrf_token() in an external js file in Laravel?

Hello @kartik, add <meta> tag with the token to the ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
1,336 views
0 votes
1 answer

How to use patch request in Laravel?

Hello @kartik, Your route is: Route::patch('users/update', 'UsersController@update'); replace your route ...READ MORE

Oct 21, 2020 in Laravel by Niroj
• 82,880 points
10,522 views
0 votes
1 answer

How to remove composer sdk from laravel packages

Use  two blade page,one for create and other ...READ MORE

Oct 15, 2020 in Laravel by Niroj
• 82,880 points
1,186 views
0 votes
1 answer

How to match input password and database hash password in laravel?

Hello @kartik, First, you'll need to find the ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
5,643 views
0 votes
1 answer

How to Decode Json object in laravel and apply foreach loop on that in laravel?

Hello @kartik, you can use json_decode function foreach (json_decode($response) as $area) { ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
12,159 views
0 votes
1 answer

How to perform a delete operation on a Model?

Hello @kartik, You can put this code for ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
351 views
0 votes
1 answer

How to give custom field name in laravel form validation error message?

Hello @kartik, You can specify custom error message ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
4,421 views
0 votes
1 answer

How to show old data of dynamic checkbox in Laravel?

Hello @kartik, This will work: ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
8,914 views
0 votes
1 answer

How to “Refresh” the User object in Laravel?

Hello @kartik, You can update the cache object ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
2,323 views
0 votes
1 answer

The stream or file "/var/www/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

Hello @kartik, Make your Dockerfile something as below ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
20,528 views
0 votes
1 answer

How can we allow the funtion to have access to $slug?

Hello @kartik, You have to use use to pass variables ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
509 views
0 votes
1 answer

How to select year and month from the created_at attributes of database table in laravel 5.1?

Hello @kartik, There are date helpers available in ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
14,269 views
0 votes
1 answer

Laravel 5.1 date_format validation allow two formats

Hello @kartik, The date_format validator takes only one date format ...READ MORE

Sep 30, 2020 in Laravel by Niroj
• 82,880 points
2,703 views
0 votes
1 answer

How can I use Guzzle to send a POST request in JSON?

Hello @kartik, For Guzzle 5, 6 and 7 you do ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
11,297 views
0 votes
1 answer

How to detect a mobile device in PHP?

Hello @kartik, Here is the code: <?php $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
2,283 views
0 votes
1 answer

How to convert a UNIX Timestamp to Formatted Date String?

Hello @kartik, Try gmdate like this: <?php $timestamp=1333699439; echo gmdate("Y-m-d\TH:i:s\Z", $timestamp); ?> Hope it helps!! Thank ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
2,645 views
0 votes
1 answer

How to generating a random password in php?

Hello @kartik, Try this (use strlen instead of count, because count on a ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
607 views
0 votes
1 answer

How to asynchronous shell exec in PHP?

Hello @kartik, good way to run an asynchronous ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
5,356 views
0 votes
2 answers

How to pass variable to next page using php?

Simply use Sessions my friend Page1: session_start(); $ ...READ MORE

Oct 6, 2020 in Laravel by anonymous
• 140 points
13,545 views
0 votes
1 answer

How to get a variable name as a string in PHP?

Hello @kartik, You can use this: function varName( $v ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
2,063 views
0 votes
1 answer

How to unzip a file with php?

Hello @kartik. PHP has built-in extensions for dealing ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
2,589 views
0 votes
1 answer

How to getting the location from an IP address?

Hello @kartik, You could download a free GeoIP ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
1,223 views
0 votes
1 answer

How to remove the querystring and get only the url?

Hello @kartik, ou can use strtok to get string before ...READ MORE

Sep 29, 2020 in Laravel by Niroj
• 82,880 points
4,071 views
0 votes
2 answers

How to delete file from public folder in laravel?

I just want to add @niroj answer  Use ...READ MORE

Nov 5, 2020 in Laravel by Helloworld
• 140 points
26,275 views
0 votes
1 answer

How to check if connected to database in Laravel?

Hello @kartik, You can use if(DB::connection()->getDatabaseName()) { echo ...READ MORE

Sep 28, 2020 in Laravel by Niroj
• 82,880 points
7,997 views
0 votes
1 answer

Error: Class 'TestCase' not found in D:\xampp\htdocs\laravel\app\tests\ExampleTest.php on line 3 ,

Hello @kartik, Run following command in your project's ...READ MORE

Sep 28, 2020 in Laravel by Niroj
• 82,880 points
1,970 views
0 votes
1 answer

Using Artisan::call() to pass non-option arguments

Hello @kartik, Use: Artisan::call('db:migrate', ['' => 'mymigration', '--table' => ...READ MORE

Sep 28, 2020 in Laravel by Niroj
• 82,880 points
1,708 views
0 votes
1 answer

How to get route action name in laravel?

Hello @kartik, To get action name, you need ...READ MORE

Sep 28, 2020 in Laravel by Niroj
• 82,880 points
4,322 views