Assets are not linking in my laravel project - laravel

after running php artisan serve my project is running on http://127.0.0.1:8000/.
I am inserting files on logo folder my inserting code is
$request->file('logo')->store('logo', 'public');
this code is inserting files inside \storage\app\public\logo\
Now when I try to view this file in image there is no image showing
my image view code is
http://127.0.0.1:8000/storage/logo/eoFICKlGoU8yDoJrLGYfKFsx6Yq4uGvDs5yC9WQ7.png
my filesystem default is 'default' => env('FILESYSTEM_DISK', 'public'),
also in the env it FILESYSTEM_DISK = public
I have tried
php artisan config:clear
php artisan storage:link
php artisan optimize:clear
But still failed to show the image in . Please help I have tried many method available on stackoverflow

Simply run, php artisan storage:link.
The problem might be that your storage is not linked to your public folder.

Related

How to change default language in Laravel?

I want my site to only be in swedish language. How to accomplish this?
In my lang/sv/ folder I have six files.
auth.php
pagination.php
passwords.php
sv.json
validation-inline.php
validation.php
The page source says html lang="sv" but everything is in english.
Also the email verification is in english.
This is what I have done so far.
In app\config\app.php I have change this
'locale' => 'sv',
'fallback_locale' => 'sv',
In my terminal I have run these commands.
composer dump-autoload
php artisan config:clear
php artisan view:clear
php artisan cache:clear
php artisan event:clear
php artisan optimize:clear
What else can I do?
I'm using Laravel 8.12.
I solved it. I had the sv.json file in the wrong folder.
It should be in lang folder not in lang\sv\ folder.

How to solve error while using Laravel 7 with livewire 1.0.13

I am trying to use Livewire 1.013 in my Laravel 7 application. I just installed livewire in my package. I am using xampp apache server. So, my project URL is like http://localhost/Projects/testproject/public .
When I do inspect the page that included with #livewireStyles and #livewireScripts, I am getting net::ERR_ABORTED 404 (Not Found) error. I did php artisan vendor:publish --tag=livewire:config and added #php artisan vendor:publish --force --tag=livewire:assets --ansi in composer.json file. The I executed composer dump-autoload . The error still exists. Can anyone help me to solve this issue?
Instead of custom project URL, if I do PHP artisan ser with URL of http://127.0.0.1:8000/ it works fine for me. But, in my case I have different project s and I have to use xampp apcahe.
Could you please help me to solve this?
Thanks in Advance !
Manu
I had this problem too. You can publish the Livewire config into your Laravel config directory:
php artisan vendor:publish --tag=livewire:config
Then change the asset_url value in the config/livewire to the root or public directory of your app to something like this:
http://localhost/Projects/testproject/public

laravel 5.2 config constant does not work on server

i seperate my strings and put them in Constant directory in textConstant.php file , in my localhost everythings are okey but when i uploads my code on my server the string fade out and nothing show in my screen ,
here is my constant file :
return [
'title' => 'test',
'book' => 'book_test',
];
and here is my code that use constant :
<button>{{config('Constants.textConstant.book')}}</button>
please help me to solve my problem because my site cannot be usable, thanks alot :)
Try to run the following code over commandline if you have enabled the cache.
php artisan config:clear
php artisan config:cache.
In CMD;
Write first
php artisan config:clear
Then
php artisan config:cache
Hope this will work.

Class App\Http\Controllers\Auth\AuthController does not exist

i followed these , laravel virsion 5.4.16
https://www.youtube.com/watch?v=bqkt6eSsRZs&t=29s
You need to regenerate namespaces autoload
composer dump-autoload
"php artisan make:auth" produces all the authentication scaffolding required for the authentication process.
Type "php artisan make:auth" in your terminal right in the directory of your project. You will need to tidy up your install by deleting the "layouts folder" folder within the "resources folder", and also change the "#extends('layouts.app')" to "#extends('main')" in the login.blade.php and register.blade.php views within the "resources/views/auth" folder. Also you should then run "php artisan route:list" to see the names and locations of the auth routes.
I hope this helps

How to use artisan to make views in laravel 5.1

I have been looking in the docs for a solution to make views with basic CURD operations but without much success.
I guess this might be pretty simple, but am missing something or not looking hard enough.
i can make models and controllers using the below artisan commands
php artisan make:model modelName
php artisan make:controller controllerName
But how do we make the basic CURD views. something like
php artisan make:views
cant find any doc for this. Please help
At the time of writing, there isn't a way to create views via artisan without writing your own command or using a third party package. You could write your own as already suggested or use sven/artisan-view.
if you are using laravel 5.1 or 5.2 this gist can help you make:view command just create command copy and paste the code from gist.
Step 1:
php artisan make:command MakeViewCommand
Step 2:
copy class from this gist
https://gist.github.com/umefarooq/ebc617dbf88260db1448
Laravel officially doesn't have any Artisan cammands for views.
But you could add third party plugins like Artisan View
Here's the link Artisan View
After adding this plugin to your project by the guide provided here you should be able to perform following cammands :
Create a view 'index.blade.php' in the default directory
$ php artisan make:view index
Create a view 'index.blade.php' in a subdirectory ('pages')
$ php artisan make:view pages.index
Create a view with a different file extension ('index.html')
$ php artisan make:view index --extension=html
There is very easy way to create a view(blade) file with php artisan make:view {view-name} command using Laravel More Command Package.
First Install Laravel More Command
composer require theanik/laravel-more-command --dev
Then Run
php artisan make:view {view-name}
For example
It create index.blade.php in resource/views directory
php artisan make:view index
It create index.blade.php in resource/views/user directory
php artisan make:view user/index
Thank you.
In v5.4 you need to create the command with:
php artisan make:command MakeView
and before you can use it, it must be registered in App/Console/Kernel like
protected $commands = [
Commands\MakeView::class
];
then you make a view like: php artisan make:view posts/create
To create a view (blade) file through command in laravel 8:
composer require theanik/laravel-more-command --dev
php artisan make:view abc.blade.php
You can install sven/artisan-view package to make view from CMD, to install package write this command:
composer require sven/artisan-view --dev
After installing it, you can make a single view or folder with all views that contain {index-create-update-show}
To make a single file we using this command:
php artisan make:view Name_of_view
For example
php artisan make:view index
To make a folder that contain all resources index - create - update - show write name of folder that contain all this files for example:
php artisan make:view Name_of_Folder -r
For example:
php artisan make:view blog -r
-r is a shorthand for --resource you can write full name or shorthand to make resource.
you can extend yields from master page if master page inside in directory layouts we write command sith this format
php artisan make:view index --extends=layouts.master --with-yields
layouts is a directory this directory may be with a different name in your project the idea is name_of_folder/master_page that you want to extend yields from it.
For more view docs

Resources