Most voted questions in Laravel

0 votes
1 answer

How to delete a single record in Laravel 5?

Hello @kartik, Delete an existing Model $user = User::find(1); $user->delete(); Deleting ...READ MORE

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

How laravel Lumen Ensure JSON response?

Hello @kartik, You'll need to adjust your exception ...READ MORE

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

How do you wrap Laravel Eloquent ORM query scopes in parentheses when chaining?

Hello @kartik, You can generate parentheses by passing ...READ MORE

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

Error: Can't get session in controller constructor

Hello @kartik, You can't do it by default ...READ MORE

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

How to set session timeout in Laravel?

Hello, In app/config/session.php you have: lifetime option that allow you to set session ...READ MORE

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

Error:file_put_contents(): Exclusive locks are not supported for this stream

Hello, After update do: chmod -R gu+w storage chmod -R ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
3,569 views
0 votes
1 answer

How to simplify this Laravel PHP code to one Eloquent query?

Hello @kartik, You create realtionship between both table friend and user in ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
787 views
0 votes
1 answer

How and where can store images with laravel?

Hello, Make directory for images in myapp/public/images and ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
580 views
0 votes
1 answer

Error:return \Redirect::route('regions')->with('message', 'State saved correctly!!!');

Hello @kartik, You can pass the route parameters ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
860 views
0 votes
1 answer

How to Insert a value to hidden input Laravel Blade?

Hello @kartik, Usually, this is used in Blade ...READ MORE

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

How to use Postman for Laravel $_POST request?

Hello @kartik, 1.You can create a new route ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
14,993 views
0 votes
1 answer

How Laravel Eloquent Model Attributes maps to the table?

Hello @kartik, If your model is filled with ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
3,438 views
0 votes
1 answer

Error:Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation

Hello @kartik, When you try to access a ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
3,738 views
0 votes
1 answer

How can I define a route differently if parameter is not integer?

Hello @kartik, Just add ->where('id', '[0-9]+') to route where you ...READ MORE

Dec 1, 2020 in Laravel by Niroj
• 82,880 points
911 views
0 votes
0 answers

how to create exception in react router using Route::get('/{path?}', 'IndexController@index')->name('index') ->where('path', '.*');

I am using react routers within Laravel ...READ MORE

Nov 15, 2020 in Laravel by datso
• 120 points

recategorized Nov 16, 2020 by Niroj 473 views
0 votes
1 answer

How to run some migrations on new user's database after its creation?

Hello, If you place database config on the database.php file, ...READ MORE

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

Error: The requested URL /login was not found on this server. Apache (Ubuntu) Server at mydomain.com Port 80

Hello @kartik,  your directory path is wrong. You ...READ MORE

Nov 12, 2020 in Laravel by Niroj
• 82,880 points
13,532 views
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
589 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,690 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,206 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,843 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,144 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,827 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
488 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,297 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
449 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,804 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,935 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,047 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,430 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,425 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,408 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,650 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
685 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
989 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,823 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,753 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,897 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,859 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,739 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,630 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,038 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,978 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,014 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
570 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
749 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,197 views