I have no idea on how to create symbolic link or symlink.
I am working on File system in laravel 5.2.
The document says th
Added same code but still getting issue. Method link does not exist. currently i am adding link in my controller constructor.
here is code:
public function index()
{
$shots=[];
App::make('files')->link(storage_path('app\public'), public_path('..\public\storage'));
return View::make('adminpages.index',['shots'=>$shots]);
}
Run this command:
php artisan storage:link
App::make('files')->link(storage_path('app/public'), public_path('storage'));
And don't forget to use App after namespace.
In a Windows environment, you can:
cmd
with Run as administratormklink /D "C:\xampp\htdocs\xxxx\yyy\public\storage\"
"C:\xampp\htdocs\xxxx\xxx\storage\public\"
On Shared Server, where one doesn't have ssh access to run
php artisan storage:link
this helps me run that from a controller, the if block code section can also be placed in a Service Provider as well as suggested by @shìpu-ahamed
public function displayForm()
{
if(!file_exists(public_path('storage'))) {
\App::make('files')->link(storage_path('app/public'), public_path('storage'));
}
return view('admin.index');
}