Latest questions in Laravel

0 votes
1 answer

How to change Yarn default packages directory?

Hello @kartik, You can create a .yarnrc file with the ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
594 views
0 votes
1 answer

How To Cast Eloquent Pivot Parameters?

Hello, In Laravel 5.1 or higher you can ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
2,697 views
0 votes
1 answer

Error:UnexpectedValueException: The Response content must be a string or object implementing __toString(), "object" given.

Hii, You can simply use: $new_collection = $collection->merge($other_collection). Hope it ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
1,210 views
0 votes
1 answer

How do I insert user into mysql table from within Laravel?

Hello @kartik, First Create seeder with artisan: php artisan make:seeder ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
2,850 views
0 votes
1 answer

How can I serve a single HTML page from the Laravel public folder without having to use the .html extension?

Hello @kartik, You may rename the test folder ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
5,146 views
0 votes
1 answer

How to post the values into validation and return the response as json rather than return view in laravel blade?

Hii, You can also tell Laravel you want ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
2,830 views
0 votes
1 answer

Error:Missing argument 2 for App\Http\Controllers\EventsController::remindHelper()

Hello @kartik, When you define this route: Route::get('events/{id}/remind', [ 'as' ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
491 views
0 votes
1 answer

How can I create a migration to add a value to an enum in eloquent?

Hello @kartik, Try using this code: public function up() ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
2,300 views
0 votes
1 answer

How to get a list of registered route paths in Laravel?

Hello, Route::getRoutes() returns a RouteCollection. On each element, you can ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
453 views
0 votes
1 answer

Error : Call to undefined method Illuminate\Http\Request::put()

Hello, You need to customize the request $data = ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
3,807 views
0 votes
1 answer

How to access client ip address in Laravel 5?

Hello @kartik, You can use this type of ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
5,940 views
0 votes
1 answer

How to alias a table in Laravel Eloquent queries using Query Builder?

Hello @kartik, You can use less code, writing ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
10,057 views
0 votes
1 answer

How to create and Update Laravel Eloquent?

Hello @kartik, There has been a couple of ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
2,432 views
0 votes
1 answer

How do you check if a field is not null with Eloquent?

Hello @kartik, Simply,we can use Model::whereNotNull('sent_at'); Or Model::whereRaw('sent_at is not null'); Thank ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
3,427 views
0 votes
1 answer

How to Use Order By for Multiple Columns in Laravel ?

Hii, Use order by like this: return User::orderBy('name', 'DESC') ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
26,448 views
0 votes
1 answer

How to Get the Current URL Inside @if Statement in Laravel?

Hello @kartik, You can use: Request::url() to obtain the current ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
3,658 views
0 votes
1 answer

How to get the Last Inserted Id Using Laravel Eloquent?

Hello @kartik, Firstly create an object, Then set ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
693 views
0 votes
1 answer

Error:Laravel requires the Mcrypt PHP extension.

Hello, Use which php in the terminal to see which ...READ MORE

Nov 11, 2020 in Laravel by Niroj
• 82,880 points
991 views
0 votes
1 answer

How do I include partials from a blade layout in laravel?

Hello @kartik, You need to give the full ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
3,835 views
0 votes
1 answer

How do I set laravel test to go to site name instead of localhost?

Hii, For Laravel 5, In the tests directory there should ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
3,029 views
0 votes
1 answer

How to get the server IP with Laravel?

Hello @kartik, You can use request object: request()->server('SERVER_ADDR'); Or you ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
3,761 views
0 votes
1 answer

How to get view data during unit testing in Laravel?

Hii, Try this: $response->getSession()->get("errors") And from there you can check ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
1,904 views
0 votes
1 answer

How to make auto login after registration in laravel?

Hello, You can try to login the user ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
4,874 views
0 votes
1 answer

How to get the subdomain in a subdomain-route in laravel?

Hello, $subdomain is injected in the actual Route callback, it is ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
5,751 views
0 votes
1 answer
0 votes
1 answer

How to manually run a laravel job using command line?

Hello, If you are using a QUEUE_DRIVER diferent to sync and you ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
12,664 views
0 votes
1 answer

How to show all the variables as proper currency format in laravel?

Hello, You could create a custom Laravel directive. You ...READ MORE

Nov 2, 2020 in Laravel by Niroj
• 82,880 points
3,046 views
0 votes
1 answer
0 votes
1 answer

Error: Class 'SoapClient' not found in /home/user/mysite.com/path/to/file.php on line 16

Hello @kartik, find this line in php.ini : ;extension=soap then ...READ MORE

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

How can I store and retrieve images from a MySQL database using PHP?

Hello @kartik, First you create a MySQL table ...READ MORE

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

How do I write to the console from a Laravel Controller?

Hello @kartik, This can be done with the ...READ MORE

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

How to Check for a Specific Type of Object in PHP?

Hello @kartik, Use: bool is_a ( object $object ...READ MORE

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

How to redirect to login if user is not authenticated in laravel?

Hello @kartik, Use middleware for this purpose and ...READ MORE

Oct 28, 2020 in Laravel by Niroj
• 82,880 points
8,209 views
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
347 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,412 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,853 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,868 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,231 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,276 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,448 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,694 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,956 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,219 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,345 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,862 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,180 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
5,011 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,334 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,782 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,833 views