laravel api url on production server - laravel-5

I am using laravel 5.5 and my API URL is http://127.0.0.1:8000/api/getService/ for GET method.
what will be the URL if I put my files on the server in folder role.
I am trying this URL http://xx.xxx.xx.xxx/role/api/public/api/roles/ but getting the 404 error

Your files are only public accessible if they are in the public folder. Everything else, unless you set it chmod 777 (don't.) you won't be able to reach it.
My advice would be: write a function that returns your files and keep your files in your storage directory.
Otherwise, if you want to access the folder images in your public folder for example, you can access it by going to http://127.0.0.1:8000/images/

Related

Link to storage folder not working on hosting

In my local project I save the images in the storage path and load normally with asset('storage/...');
Everything works smoothly. I do not have full access to the hosting to upload the project. only access via FTP, no ssh access. When the project is unpacked on the hosting, the storage link in the public folder brings all the files as a folder. I removed it and because I don't have ssh access I declared a route to execute the command.
Route::get('storage-link', function(){
Artisan::call('storage:link');
echo (Artisan::output());
});
When running the route, it even prints the message that it normally shows when the command is run in the console, saying that the link between the folders was created.
The problem is that the images do not load.
asset('/storage/cars/photo.jpg')
if I pass the folder to the public and call it without going through the link to the storage folder asset('/cars/photo.jpg') it shows it correctly.
I hope you can help me. Thanks in advance.

How to load schema.graphql in laravel graphql-playground without using public folder and php artisan

I am developing a graphql based laravel app and using Lighthouse for the purpose.
Now I have to access the playground through localhost/blog/graphql-playground (without using artisan or writing public every time), for this purpose I have copied content of 'public' folder to the index folder. Every controller including graphql-playground seems to work but playground cannot fetch schema.graphql placed in root directorie's graphql folder (localhost/blog/graphql) with error 'Server cannot be reached'. but if I give URL localhost/blog/public/graphql it will work. I have went through all the possible files and couldn't file settings to be changed. I tried deleting content of public folder. after that even /public wouldn't work.
How do I fix this?
see image
I think that your artisan server is running on port 8000. So try with http://localhost:8000/graphql.

Laravel File Storage Location Confusion

I am struggling to wrap my head around the file storage in laravel. I setup the php artisan storage:link like it said to do online.
Then to store my images in my store method
$request->file('brandimage')->storeAs('/public/brandimages', $filename);
I tried doing it without the /public but it throws an error. This means when I want to delete the files I have to use
Storage::delete('public/' . $brand->brand_image_path);
(The brand_image_path is: thumbimages/thumb-post-5.jpg so it isnt adding any extra directories.
My issue is when transfer my site from local to my server none of my images show up. My project is looking for them at www.sitename.com/thumbimages/thumb-post-5.jpg but in order to actually see them I have to go to www.sitename.com/storage/thumbimages/thumb-post-5.jpg"
I'm guessing that it should work the same local as it does on the server so what part am I doing wrong?
I discovered that I should be using /storage/thumbimages/thumb-post-5.jpg" even when I am on local. /storage and not using /storage both work on local.

Code Igniter - creating folder in FTP

I need your help. I am trying to create folders on my FTP server through my Code Igniter web application. If the manager clicks attachments on projects a folder gets created if it doesn't exists yet and then through file upload he populates it with files.
I have achieved all this when running the code on localhost (the folders got created, and file upload worked too), however when I uploaded my app to a live site I couldn't create folders, so I googled a little and found out I should use the ftp library, because I couldn't create the folders with the relative paths I had.
However, I still cant seem to create the folder with the following code.
if($this->ftp->list_files('attachments/výkres'.$id) == FALSE)
{
$this->ftp->mkdir('attachments/'.$id);
}
I always get the error:
Unable to create the directory you have specified.
Hope this will help you :
use with full path with starting and ending slashes like this:
if($this->ftp->list_files('/public_html/your_path/attachments/yýkres'.$id.'/') == FALSE)
{
$this->ftp->mkdir('/public_html/your_path/attachments/'.$id.'/', DIR_WRITE_MODE);
}
for more : https://www.codeigniter.com/user_guide/libraries/ftp.html#CI_FTP::mkdir

Laravel 4 - can't access images in public folder

I have a strange behaviour from Laravel. I just copied the website to a new hoster. Everything is working quite fine but one thing: I can't access the images in my public folder. If I try to open an image on my own with "domain.com/img/Ausfahrten/42.png i get the following error:
error image loading
The folder structure on my server looks like this:
enter image description here
What method can't laravel find and how can I resolve this? I've already checked file permissions on the server, everything's fine there.
Laravel throw that error when it cannot find the file. Try to access to another directory without Uppercase letter in its path name.

Resources