Questions tagged [laravel-8]

Laravel 8 is the 8th version of the open-source PHP web framework created by Taylor Otwell. It was released on September 8, 2020. Please use the [laravel] tag for general Laravel-related questions.

Filter by
Sorted by
Tagged with
608 votes
24 answers
398k views

How to create custom helper functions in Laravel

I would like to create helper functions to avoid repeating code between views in Laravel. For example: view.blade.php <p>Foo Formated text: {{ fooFormatText($text) }}</p> They're ...
Calebe Oliveira's user avatar
337 votes
32 answers
573k views

Error “Target class controller does not exist” when using Laravel 8

Here is my controller: <?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class RegisterController extends Controller { public ...
Nguyễn Việt Dũng's user avatar
62 votes
7 answers
74k views

'mix' is not recognized as an internal or external command in Laravel 8 new installation

I have installed a new Laravel 8 application, and then I ran... npm install Afterward, I ran... npm run dev I get the following error. 'mix' is not recognized as an internal or external command &...
Spiral's user avatar
  • 953
52 votes
8 answers
34k views

Error: While updating laravel 8 to 9. Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Nothing to install, update or remove Generating optimized autoload files Class App\Helpers\Helper located in C:/wamp64/www/vuexylaravel/app\Helpers\helpers.php does not comply with psr-4 autoloading ...
Sajeed Kannoje's user avatar
48 votes
4 answers
72k views

How to fix laravel 8 UI paginate problem?

I had a problem while trying out the recently released laravel 8, I'm trying to find out what the changes are and how it works. When I did that I had a problem with the paginate laravel 8 UI getting ...
Habi nata's user avatar
  • 630
48 votes
7 answers
12k views

“vagrant” will damage your computer. | macOS v12 (Monterey) #13132 [closed]

Today morning suddenly I started getting this popup whenever I ran Vagrant up in my Mac. VirtualBox version 7.0.4 r154605 (Qt5.15.2). macOS v12 (Monterey), MacBook Pro (Retina, 15-inch, Mid 2015) ...
Jigar's user avatar
  • 3,113
39 votes
9 answers
110k views

How to Install Vue.js in Laravel 8

I am using laravel 8 and now I want install Vue.js. I am trying like this composer require laravel/ui php artisan ui vue php artisan ui vue --auth
Ehab Talaat's user avatar
38 votes
8 answers
49k views

SerializableClosure error in Laravel - Your serialized closure might have been modified and it's unsafe to be unserialized

I am getting this error in my domain where I have used laravel v8 for my site. It shows error in line no 52 in index file: Previously my .env file was not reading. As soon as I fixed that error I ...
Cherryl Rarewings's user avatar
36 votes
10 answers
53k views

Laravel, Call to undefined function Database\Seeders\factory()

I get the title error when I run command: php artisan db:seed My screenshot: I have no idea where this problem comes from. I was searching for code examples and solution but I haven't found anything ...
Jakub Padło's user avatar
35 votes
11 answers
78k views

Laravel, NPM: Command "mix" not found

Does anyone have an idea why it throws the following error and how to fix it? I have also tried to reinstall all packages using npm install several times. Reinstalling NodeJS on Windows didn't work; I'...
Pinnokkio's user avatar
  • 509
24 votes
6 answers
25k views

Can't connect to database Laravel Sail

I'm trying to create a simple laravel project and I'm following a laracast to set up the project with Sail. The project is running fine and I was able to migrate with vendor/bin/sail artisan migrate. ...
FonsVC's user avatar
  • 451
23 votes
6 answers
49k views

How to properly start Laravel 8 with Bootstrap & authentication

I face the following image every time I want to start a new Laravel 8 project with authentication routes set up using the laravel/ui package and Bootstrap scaffolding. Meaning that the Bootstrap is ...
user avatar
22 votes
1 answer
109k views

Target class does not exist. problem in laravel 8 [duplicate]

When create a new project with laravel 8 and I get this error. Illuminate\Contracts\Container\BindingResolutionException Target class [SayhelloController] does not exist. http://127.0.0.1:8000/users/...
user avatar
19 votes
5 answers
27k views

Unable to set the APP_PORT on .env for Laravel Sail

I have the following problem in Windows 10 (in Ubuntu works properly): I'm working in Laravel 8 with Sail When I create the APP_PORT variable on .env... APP_NAME=Laravel APP_ENV=local APP_KEY= ...
Fredy Rosero's user avatar
18 votes
6 answers
62k views

How to install bootstrap in laravel 8

All of the info I can find online says that you should install bootstrap by running composer require laravel/ui and then php artisan ui boostrap. However, in Laravel 8, laravel/ui is deprecated. Is ...
MrSandyWilly's user avatar
17 votes
5 answers
23k views

Unable to use Laravel Factory in Tinker

I am unable Model Factory in Laravel Tinker. //ItemFactory.php class ItemFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ ...
Lizesh Shakya's user avatar
17 votes
8 answers
23k views

Disable Auth Register route in Laravel 8?

I need to disable my register route in Laravel 8. Tried Auth::routes([ 'register' => false, 'login' => false, ]); but the application threw up an error. RuntimeException In order to ...
Debajeet Choudhury's user avatar
16 votes
3 answers
25k views

Laravel error: Laravel Sail no such File or directory found

I am following this tutorial, I installed Docker and WSL2(Ubuntu 20.04.4 LTS) on my windows system, as shown in image below, When i am trying to run Laravel project using command, ./vendor/bin/sail ...
Fayakon's user avatar
  • 1,403
16 votes
5 answers
10k views

How to override the validation rule login Laravel\Fortify?

This described in the class Laravel\Fortify\Http\Requests\LoginRequest I want to add one more validation line namespace Laravel\Fortify\Http\Requests; use Illuminate\Foundation\Http\FormRequest; use ...
Alex Itet's user avatar
  • 199
15 votes
5 answers
70k views

How to fix this error Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined. in laravel 8?

i have one controller which contains three functions (register,login,forgotPassword).for login and registration it's working fine but when i try to hit an API in postman i am getting an error,...
Sravani's user avatar
  • 407
15 votes
4 answers
22k views

how do you enable ssl using laravel 8 sail

I just created a new Laravel 8 project, following the instructions in their docs. Using Laravel Sail I have the site running locally on my machine just fine using sail up. I have set up an entry in /...
smenzer's user avatar
  • 317
15 votes
3 answers
5k views

Laravel 8 misbehaves on trailing slash

There is a problem occurring while using APIs with trailing slash. Route Route::post('user/register','UserController@register'); It's working fine when I called this route POST from the postman/...
Muhammad Shareyar's user avatar
14 votes
5 answers
19k views

can't use migrate with sail laravel

Hi I've just tried and to install Laravel 8 with sail and I've run into a problem What I've done is to first run the curl one-liner from laravel's own page curl -s https://laravel.build/sail-test | ...
Touchpad's user avatar
  • 702
13 votes
2 answers
20k views

Laravel 8 rest api email verification

After a huge search in the internet and in the forum, I just gave up... I am develping a rest api using Laravel 8 and I am trying since week to make the email verification working using the officiel ...
Gothiquo's user avatar
  • 868
13 votes
2 answers
6k views

Laravel 8 factory state afterCreating

Laravel 7 factories had method afterCreatingState() where you could define what should happen after Model with specific state was saved into database. $factory->afterCreatingState(App\User::class, '...
Nebster's user avatar
  • 904
13 votes
4 answers
13k views

Failed to install laravel/jetstream on laravel 8

after the installation of jetstream via composer composer require laravel/jetstream then suddenly get an ErrorException that there's no such file or directory. Writing lock file Generating optimized ...
VLDCNDN's user avatar
  • 692
13 votes
6 answers
23k views

Laravel Fortify Customize Authentication Redirect

In Laravel fortify on customization authentication process, i can not able to redirect to login page with error message which we were able to do in Auth. Here is the customization documentation link: ...
SK Toke's user avatar
  • 334
13 votes
5 answers
30k views

Best way to store and load JSON from database in Laravel

I'm trying to store json into a db and load it back I tried to store {name: "John", age: 31, city: "New York"} It stored correctly. I checked the db, it showed correctly. {name: &...
code-8's user avatar
  • 56.7k
12 votes
4 answers
39k views

Laravel Access css and js file from resources css and js directory

This is my directory structure. -resources -css -mycss.css -js -myjs.js -myimagesfolder -views -admin -home.blade.php how can i access resources>css>mycss.css , ...
Dhairya Lakhera's user avatar
12 votes
3 answers
9k views

Laravel 9 app (upgraded from 8) lang directory not working as expected

I have upgraded my Laravel 8 application to version 9, and according to the docs: upgrade guide, the resources/lang directory is now located in the root project directory (lang). I've moved the lang ...
Marcelo The Mage Coder's user avatar
12 votes
3 answers
10k views

Laravel 8 Jetstream: adding new field to the registration process

I started building a web application using Laravel 8. I have noticed that quite a lot of things have changed in Laravel 8 including authentication. Now, I am trying to use Jetstream for auth. I have ...
Wai Yan Hein's user avatar
  • 14.2k
11 votes
3 answers
31k views

LARAVEL 8: Class 'Database\Seeders\DB' not found

I'm working with seeder to fill my users table, so I created a new seeder called UserSeeder and then I added these codes to it: public function run() { foreach(range(1,10) as $item) { ...
user avatar
11 votes
3 answers
13k views

Vue + Laravel sanctum CSRF token mismatch 419 error

I get a "419 (unknown status)" error with the message "CSRF token mismatch." POST http://127.0.0.1:8000/login 419 (unknown status) CSRF token mismatch. Laravel server : http://127....
Ryo ID's user avatar
  • 113
11 votes
3 answers
35k views

Laravel 8 - Could not find driver : Illuminate\Database\QueryException could not find driver (SQL: select * from `list`)

I have installed Laravel 8 on my Linux Mint 20 for my personal experiment so I'm new on Laravel's new version. I've searching many source how to show tables with CRUD method so the table is shown in ...
Pup In The Tree's user avatar
11 votes
2 answers
17k views

Laravel 8 & Laravel Sail for dev on Windows 10 is slow. How to speed up?

How can I recreate this? Create install from Laravel 8 docs and Laravel Sail docs. I use the sail up command, which works great. The command builds docker containers, connects them, and makes ...
Bart's user avatar
  • 1,937
11 votes
3 answers
10k views

How to set the rate limiter for per second in Laravel version 8

How to set the rate limiter per second in Laravel 8. I need to set the rate limiter per second instead of per minute. Rate Limiter (Laravel 8) - https://laravel.com/docs/8.x/routing#rate-limiting ...
Mahe Krish's user avatar
10 votes
4 answers
17k views

render function in Handler.php not working Laravel 8

I want to return a JSON response instead of the default 404 error page when ModelNotFoundException occurs. To do this, I wrote the following code into app\Exceptions\Handler.php : public function ...
user avatar
10 votes
4 answers
8k views

Laravel 8.15.0/Jetstream - How to register new blades x-jet-newblade?

I am just doing my very first steps with Laravel 8 and found a problem that I can not solve. /var/www/html/laravel/resources/views/dashboard.blade.php: <div class="py-12"> <...
operator's user avatar
  • 105
10 votes
2 answers
18k views

storage\logs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

I have developed my application in Laravel 8, it's working fine in localhost and Linux server. But When I deployed it in Plesk Windows Server it's showing permission denied error. ...
Samad's user avatar
  • 111
10 votes
2 answers
32k views

Route to controller in Laravel 8 [duplicate]

I'm working with Laravel 8 and when I write the route to the __invoke controller like this: use App\Http\Controllers\PortfolioController; Route::get('/portfolio', 'PortfolioController')->name('...
Jota's user avatar
  • 117
10 votes
3 answers
11k views

Tailwindcss @apply directive doesn't work inside vue component

I create a laravel application with jetstream and inertia-vue stack for my new project problem is Tailwindcs version 2 using postCss and it doesn't support @apply directive inside vue components but ...
Shekh Saifuddin's user avatar
10 votes
6 answers
12k views

Problem with action Controller@store not defined in Laravel 8

I'm still exploring Laravel 8 but I have a problem with my controller's store() method 'not defined.' InvalidArgumentException Action PostsController@store not defined. (View: D:\Server\htdocs\app\...
lily's user avatar
  • 199
10 votes
3 answers
5k views

Can't enter my password when trying to create a Laravel project with Sail on Windows

I want to create a new Laravel 8 project and I followed the documentation with docker and Sail on Windows: https://laravel.com/docs/8.x#getting-started-on-windows After I installed everything, I tried ...
chinyoka's user avatar
  • 103
9 votes
5 answers
6k views

Laravel Passport Not Returning Token

I've created an authentication controller using laravel passport, but the result is not what it usually is. variable $token = $user->createToken('TestApp')->accessToken; does not generate tokens ...
Barraaa's user avatar
  • 103
9 votes
3 answers
14k views

Calling Laravel Seeder inside folder

I've upgraded to Laravel 8, but my custom seeder in a subdirectory is not working. The file is at database/seeders/tests/TestSeeder.php. When I run the command php artisan db:seed --class="...
Kenneth's user avatar
  • 2,913
9 votes
1 answer
4k views

laravel, sail shell and sail artisan command stop working

sail shell and sail artisan command has stop working. But sail up and sail down are still working. Version details php: 8.0.5 laravel: 8.41.0 sail: 1.5.1 docker: 3.3.3 os: macOS 11.3.1 My docker-...
parth's user avatar
  • 1,833
9 votes
7 answers
30k views

"ReflectionException Function () does not exist" when trying to setup authentication in Laravel

I'm having some trouble getting authentication working 100% in Laravel (all views seem to work so far except for "home") and was hoping to get some assistance from the Laravel experts out ...
adb's user avatar
  • 248
9 votes
3 answers
5k views

Return value of artisan handle function console command

I created an artisan command using this command: php artisan make:command --command=custom:command SomeCustomCommand After I ran the command it created the file below: <?php namespace App\Console\...
aceraven777's user avatar
  • 4,528
9 votes
1 answer
7k views

Can't install jenssegers/mongodb in Laravel 10

I am new to Laravel. I want to connect to MongoDB using Laravel 10 which require jenssegers/mongodb to be installed. When I run command composer require jenssegers/mongodb 3.8.0 --ignore-platform-reqs ...
Atapol's user avatar
  • 95
9 votes
1 answer
10k views

Corrupted composer.json file in Laravel 8

When I tried to remove the package maatwebsite/excel from my project, I damaged something badly. The problem is that I can't track the changes I made. Before I removed maatwebsite/excel from composer....
peterw's user avatar
  • 91

1
2 3 4 5
147