nhayder

nhayder

Member Since 1 Year Ago

Doha

Experience Points 32,060
Experience Level 7

2,940 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 222
Lessons
Completed
Best Reply Awards 2
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

22 Apr
3 days ago

nhayder left a reply on How To Allow Blade To Except (<a Href>, <br /> ... Etc)

@ashraam you solution is not secured? by doing this {!! $code !!} the page will render every html the a user might add to the input field? where i need to filter them ??? ( + keyboard enter + ).

My question was ??? is there is a laravel way of filtering html tags from blade engin???

i can use aanitization package if i have to, i'm just trying to find how laravel will handle it nativally with not extra package?

@jlrdw What is your recommendations for my case

nhayder started a new conversation How To Allow Blade To Except (<a Href>, <br /> ... Etc)

I have contenteditable div on my app, using vue im saving input of the user like this

// example
            <h1 v-html="widget.title" ref="wTitle"

            @blur="save"

                contentEditable>
              
            </h1>

// this is vue save function
            save: function(){

                let id = this.id;

                let text = this.$refs.wTitle.innerHTML;

                this.$store.dispatch('saveText', [id, text, 'title']);

            },


the code above is not allowing me to save keyboard (enter, white space) in stead its returning html on the page

// something like this
[space bar click] [space bar click] this is my name [space bar click] [keyboard enter]
&nbsp; &nbsp;this is my name&nbsp; &nbsp;

and its stripping out tags, ...

i want blade to except specific html tags like , [space bar click]etc, ...

i'm NOT planning to use sanitization packages because most of the are not updated,

preferably i want to use laravel build it features to help out in rendering specific tags on the page.

Any Ideas ????

30 Mar
3 weeks ago

nhayder left a reply on Looking For Package Recommendation To Parse Youtube Video

@cronix just corrected the original post? Thanks anyway

nhayder left a reply on Looking For Package Recommendation To Parse Youtube Video

@cronix i was thinking of a package so i will be able to embed not only youtube video with others providers like vimeo, dailymotion, videospace, ... etc

nhayder left a reply on Looking For Package Recommendation To Parse Youtube Video

@CRONIX - @cronix how are you, what i mean is to let me user to use proper url like

https://www.youtube.com/watch?v=8cqtnUNsl_g

and the package should embed it properly

<iframe width="560" height="315" src="#####" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

nhayder started a new conversation Looking For Package Recommendation To Parse Youtube Video

Looking for reliable package for laravel 5.8 to parse youtube video intro embedded media, ???

Any recommendations

29 Mar
3 weeks ago

nhayder left a reply on Dynamically Run Seeder File From Controller

this solved the issue

        $class = "\Database\Seeds\$request->seederFile";

i removed the {} and the () from same line

nhayder left a reply on Dynamically Run Seeder File From Controller

@MANELGAVALDA - @manelgavalda I updated the code as per your remarks but still getting different error

{message: "Method Illuminate\Http\Request::installer does not exist.",…}

through the dd($request->seederFile) is returning the correct data

nhayder started a new conversation Dynamically Run Seeder File From Controller

I'm seeding DB records from controller and things are going well till i'm decided to dynamically seed DB from multiple files

        $wSeeder = new \Database\Seeds\_JumbotronSeeder();

        $wSeeder->run($request->page_id, $wSorting);

so i need to do something like this

        $wSeeder = new \Database\Seeds$request->seederFile();

        $wSeeder->run($request->page_id, $wSorting);

``

the solution above will totally help me out with my issued but i keep on getting error

{message: "syntax error, unexpected '$request' (T_VARIABLE), expecting identifier (T_STRING)",…}


any ideas on how to fix this ???
28 Mar
4 weeks ago

nhayder left a reply on Scroll Page To Page To Section With Maching ID

@ftiersch thank you for your comment, the ID is correct on the code, but NOW im trying to make the same functionality with vue refs.

so what would the code look like using ref's

nhayder started a new conversation Scroll Page To Page Section With Highest ID

i have a blade page with multiple sections, using JS i need to scroll page to the section with highest ID

// this is the section
              <section class="flex flex-col justify-center relative widget-bg-image" 

                v-for="(widget, index) in widgets" :key="widget.id" 

                :class="[ wCornerTL(widget), wCornerTR(widget) ]"

                :id="widget.id"

              >

when the page loads it should scroll to the section with highest id

  created(){

    Event.$on('requestToScrollPageDown', (id) => {
        
          var ele = document.getElementById('widget-'+id);

          var maxid = 0;

          ele.map(function(obj){   

              if (obj.id > maxid) maxid = obj.id;

              var maxID = 'widget-'+maxid;

          });

          window.scrollTo(maxID.offsetLeft,maxID.offsetTop); 

    });

any idea on how to fix this ????

24 Mar
1 month ago

nhayder started a new conversation Can't Force Laravel To Href Link Should Be From Root

This should be simple but yet its not getting done, :-0,

i have freaking simple href link and laravel keeps appending the link to http://127.0.0.1:8000 to the beginning of the link.

on my controller the $button->weblink contains http://abc.com but instead to visiting http://abc.com laravel is giving me http://127.0.0.1:8000/http://abc.com.

i tried these but nothing seems to fix the issues ???


<a href="{{url($button->weblink)}}"></a> // returning http://127.0.0.1:8000/http://abc.com

<a href="{{$button->weblink}}"></a> // returning http://127.0.0.1:8000/http://abc.com

<a href="/{{$button->weblink}}"></a> // returning http://127.0.0.1:8000/http://abc.com

how to fix this thing ??? the link should redirects to http://abc.com

any idea ???

nhayder left a reply on Can't Access Seeder File After Moving File Storage

@manelgavalda are you sure about the reserved keywords thing ??? because i changed the name to

Database\Seeds\Aaa\Anyname\TestSeeder.php

and i'm still getting same error

{message: "Class 'Database\Seeds\aaa\Najem\TestSeeder' not found",…}

I'm not sure if i understood you correctly

nhayder left a reply on Can't Access Seeder File After Moving File Storage

@manelgavalda Can you have a look at this update

nhayder started a new conversation Can't Access Seeder File After Moving File Storage

i'm a seeder file \Database\Seeds\TestSeeder.php and i'm running the file from controller like this

<?php

namespace App\Http\Controllers;

use Illuminate\Database\Seeder;
use Illuminate\Http\Request;
use App\Widget;
use cache;

use Illuminate\Support\Facades\DB;

class WidgetController extends Controller
{

    public function store(Request $request)
    {
        $seeder = new \Database\Seeds\Widgets\Static\TestSeeder();

        $seeder->run();
        
    }

I started getting this error after moving the file to \Database\Seeds\Widgets\Static\TestSeeder.php

{message: "syntax error, unexpected 'Static' (T_STATIC), expecting identifier (T_STRING)",…}

this is my seeder file

<?php
namespace Database\Seeds;

use Illuminate\Database\Seeder;

class TestSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        \DB::table('widgets')->insert([
            [
                'name' => 'intro-jumbotron',
                'user_name' => '',

                'dynamicbtn' => '0',
                'dynamicbtnurl' => 'javascript:void(0)',
                'cellmanagement' => '0',
                'fullscreendisabled' => '1',
                'showbuttonsdisabled' => '1',
                'showarrowdisabled' => '1',

                'page_id' => '1',
                'sorting' => '1',
           
                'fullscreen' => '0',
                'narrow' => '1',
                'pt' => 'pt-10',
                'pb' => 'pb-10',
                'mt' => '0',
                'mb' => '0',
                'mr' => '0',
        // ->list continues

any ideas

nhayder left a reply on Can't Access Seeder File From Controller

@manelgavalda yah, it's working now, Thank you

nhayder left a reply on Can't Access Seeder File From Controller

@manelgavalda after dump-autoload im getting

{message: "Class 'Database\Seeds\DB' not found",…}

nhayder left a reply on Can't Access Seeder File From Controller

@MANELGAVALDA - thank you but still cant access the file

updated seeder

<?php
namespace Database\Seeds

use Illuminate\Database\Seeder;

class TestSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('widgets')->insert([
            [
                'name' => 'intro-jumbotron',
                'user_name' => '',

                'dynamicbtn' => '0',
                'dynamicbtnurl' => 'javascript:void(0)',
                'cellmanagement' => '0',
                'fullscreendisabled' => '1',
                'showbuttonsdisabled' => '1',
                'showarrowdisabled' => '1',

                'page_id' => '1',
                'sorting' => '1',
           
                'fullscreen' => '0',
                'narrow' => '1',
                'pt' => 'pt-10',
                'pb' => 'pb-10',
                'mt' => '0',
                'mb' => '0',
                'mr' => '0',
                'ml' => '0',

nhayder started a new conversation Can't Access Seeder File From Controller

i have a test seeder stored on Database\seeds\TestSeeder.php. From a controller on my app im trying to run the seeder file like but i keep getting this error

message: "Class 'Database\Seeds\TestSeeder' not found",…}

this my controller

<?php

namespace App\Http\Controllers;

use Illuminate\Database\Seeder;
use Illuminate\Http\Request;
use App\Widget;
use cache;

use Illuminate\Support\Facades\DB;


class WidgetController extends Controller
{
    public function store(Request $request)
    {

        $seeder = new \Database\Seeds\TestSeeder();

        $seeder->run();
        
    }

}

this is my seeder file

<?php

use Illuminate\Database\Seeder;

class WidgetSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('widgets')->insert([
            [
                'name' => 'intro-jumbotron',
                'user_name' => '',

                'dynamicbtn' => '0',
                'dynamicbtnurl' => 'javascript:void(0)',
                'cellmanagement' => '0',
                'fullscreendisabled' => '1',
                'showbuttonsdisabled' => '1',
                'showarrowdisabled' => '1',

                'page_id' => '1',
                'sorting' => '1',
           
                'fullscreen' => '0',
                'narrow' => '1',
                'pt' => 'pt-10',
                'pb' => 'pb-10',
                'mt' => '0',
                'mb' => '0',
                'mr' => '0',
                'ml' => '0',
            // -> list continues
            ]
        ]);
    }
}


any idea what is going on ??

21 Mar
1 month ago

nhayder left a reply on How To Cache Model Relationship

@ftiersch thank you for your comment, actually i'm catching it because the $btnArticle object is unique for every user?? and when its established it shouldn't be changed??? so it should be cached and it should be unique for every user.

that's what why i'm trying to unique it with 'btnArticle-'.$this->id, which clearly not working

I hope im much clear for you

nhayder started a new conversation How To Cache Model Relationship

Hi, I'm trying to cache hasOne relationship on my app but not sure what is the best way to do this type of caching, The relationship will get hits from multiple inputs and every time it should generate different cache, so cache name will be like 'btnArticle-'+$id;

// this is my relationship
    public function btnArticle()
    {
        $btnArticle = Cache::rememberForever('btnArticle-'.$this->id, function () {

            return $this->hasOne(Article::class, 'id', 'articlelink')->with('category');

        });
        
        return $btnArticle;
    }

the code above is returning

"You cannot serialize or unserialize PDO instances (View: /Applications/MAMP/htdocs/linxtter3/resources/views/admin/designer/widgets/includes/buttons.blade.php)  ▶"

any idea what is going on

nhayder left a reply on Way To Secretly Hide Code Within Laravel

@shez1983 cron job will follow your logic as soon as they hit the end point (domain/cron/run) of your code to run.

if @skycoder want to delete files, user article, user membership he will be able to do that directly from the crons controller?

18 Mar
1 month ago

nhayder left a reply on Way To Secretly Hide Code Within Laravel

@skycoder you basically need to issue a license for every installation on your app, then you can make cron jobs so you will validate the license frequently (daily, monthly, ...etc). keep in main that crons can follow your codes login so? basically you can write your code to delete all files on the server or just block all users from logging in till the lisances issues is corrected.

AND IF, the issues is corrected the next cron job will pick up these changes and follow your logic to reactivate the license again.

nhayder left a reply on Route Group Prefix No Working

can you explain further more, you need to expand on this

nhayder left a reply on Access Seeder File From Controller

@erik that code will run the hall seeder, my point was to run part of it only

nhayder started a new conversation Access Seeder File From Controller

i have a seeder file containing a collection of data

        DB::table('widgets')->insert([
            [
                'name' => 'user-settings',
                'user_name' => '',
                    'dynamicbtn' => '0',
            ],
        [
                'name' => 'social-media',
                'user_name' => '',
                    'dynamicbtn' => '0',
            ],
        ... // code continues

im accessing the seeder file from a controller to setup users account looks sothing like that

$seeder = new \Database\Seeds\WantedSeeder();

$seeder->run();

the code is working just fine but the problem is that my seeder file contains almost 10 seeds for DB records, so by running the run() comande i'm adding 10 records to DB where i need to add only social media part of the seeder file ??

is there is a way to do that ??? any ideas ??

nhayder left a reply on How To Check If A Value Is True Or False In Blade

ok there should be and else for fix this,

done

nhayder started a new conversation How To Check If A Value Is True Or False In Blade

i'm trying to check if a value is true or not so i can forward a user to proper page like this

@if($button->pagetarget == true)
    
    target="_blank"

@endif

this is how the pagetarget look on the object when dd() the collection

pagetarget: false,

any ideas ???

07 Mar
1 month ago

nhayder left a reply on How To Access Seeder Data From Controller

Thank you, Great point to my problem :-)

nhayder left a reply on How To Access Seeder Data From Controller

I'm not sure why you're trying to pluck a query or except a route name from a query that i'm not requering ???

i'm not trying to fetch data from DB, I'm TRYING TO INSERT DATA into DB directly from a controller by grabing a specific array on a seeder file ????

nhayder left a reply on How To Access Seeder Data From Controller

How can you pluck the DB when its empty ???? the data is still not seeded in the DB? i'm supposed to seed it from controller NOT CLI.

nhayder left a reply on How To Access Seeder Data From Controller

Yes, That is exactly what i'm trying to do, But i need to retreave spacific array from that file not all data. if you look at my post above i have this array for example.

        DB::table('widgets')->insert([
            [
                'name' => 'user-settings',
                'user_name' => '',
                    'dynamicbtn' => '0',
            ],
        [
                'name' => 'social-media',
                'user_name' => '',
                    'dynamicbtn' => '0',
            ],
        ... // code continues

my question was how to access the seeder file from a controller and grab specific array (example -> the that have name = user-settings)

i'm not sure if that is possible

nhayder left a reply on How To Access Seeder Data From Controller

Yes i can, But i need to access the seeder file from controller, That was my initial post all about

nhayder started a new conversation How To Access Seeder Data From Controller

I have hardcoded seeder file on my laravel App, and i'm in a situation where i need to insert new DB record that is identical to the data on the seeder file.

        DB::table('widgets')->insert([
            [
                'name' => 'user-settings',
                'user_name' => '',
                    'dynamicbtn' => '0',
            ],
        [
                'name' => 'social-media',
                'user_name' => '',
                    'dynamicbtn' => '0',
            ],
        ... // code continues

So how to access specific array like (user-settings) directly from controller amming at feeding DB with hardcoded data as start.

Any Ideas?

27 Feb
1 month ago

nhayder started a new conversation Can't Write Image Data To Path

i'm using image intervention ti create thumbnails for images on my app, but i'm getting this error every time i try to save the thumbnail on target folder

when new images is loaded im creating a folder with main image and its thumbnail included in that new folder

    public function uploadphotos(Request $request)
    {
        
        $request->validate([

            'file' => 'required|image|mimes:jpeg,png,jpg,gif|max:50000',

        ]);
        
        $image = new Cloudfolder();
        
        $fileName = time()."-".$request['file']->getClientOriginalName();

        $image->uuid = (string) Str::uuid();
        $image->name = strtolower($fileName);
        $image->type = 'image';
        $image->downloads = 0;
        $image->user_id = Auth::id();
        $image->save();

        // Store file on cloudfolder
        Storage::makeDirectory('cloudfolder/'.$image->id); 

        $request->file->storeAs('cloudfolder/'.$image->id.'/', $fileName); // this saves the original file 

        // creating the thumbnail

        image::make($request->file)

            ->fit(50, 50, null, 'center')

            ->save(Storage::url('app/cloudfolder/'.$image->id.'/'.'sm-'.$fileName));
        
    }

26 Feb
1 month ago

nhayder left a reply on Uploading Files Using Axio And Laravel Returning Tmp Name Instead Of Real Fine Name

ok this fixed it

$image->name = $request['file']->getClientOriginalName();

nhayder started a new conversation Uploading Files Using Axio And Laravel Returning Tmp Name Instead File Name

i'm working on a file uploader using axio, vue and laravel his is my migrate

    public function up()
    {
        Schema::create('cloudfolders', function (Blueprint $table) {
            $table->increments('id');
            $table->uuid('uuid')->nullable();
            $table->string('name');
            $table->string('type')->default('image');
            $table->string('downloads')->nullable();
            $table->integer('user_id');
            $table->timestamps();
        });
    }


i have a file uploader on vue component

                  <form method="POST" enctype="multipart/form-data" @submit.prevent="handleFileUpload">

                    <input type="file" id="file" ref="myFiles" @change="selectedFile">

                    <span v-if="uploadedFile"> {{uploadedFile.name}}</span>

                    <div class="mt-4 mb-4">

                      <button class="linx-btn hover:border-blue hover:text-blue focus:bg-grey-lightest" type="submit" 

                        style="outline: none;" 

                        :class="isDisabled ? 'disabled' : ''"

                        :disabled="isDisabled"

                        >

                        Upload File

                      </button>


                  </form>

in same component i have the function to upload the file

<script>

import {mapState} from 'vuex'

    export default {

        name: 'ImageUploader',

        data () {

            return {

                gallery:false,

                fullURL : '/media/default/placeholder.png',

                filename : '',

                errors:[],

                isDisabled  : false,

                uploadedFile : '',

            }

        },


methods:{

handleFileUpload : function(index){

    this.isDisabled = true

    let formData = new FormData();

    formData.append( 'file', this.uploadedFile);

    console.log(this.uploadedFile);

    axios.post( 'api/uploadphotos',

      formData,

      {

        headers: {

            'Content-Type': 'multipart/form-data'

        }

      }

    ).then( response => {

      this.$store.dispatch('addPhoto', response.data);
  
      this.name = '';
  
      Event.$emit('requestAlertSuccess');

    })

    .catch( error => {

        if (error.response.status == 422) {

          this.isDisabled = false;

          this.errors = error.response.data.errors;

          Event.$emit('requestAlertSuccess');

        }

    });

    this.isDisabled = false;

    event.target.reset();

    this.errors = '';

},
}

</script>

the controller on laravel (api/uploadphotos)

    public function uploadphotos(Request $request)
    {
        
        $request->validate([

            'file' => 'required|image|mimes:jpeg,png,jpg,gif|max:25000',

        ]);
        
        $image = new Cloudfolder();
        
        $image->uuid = (string) Str::uuid();
        $image->name = $request['file'];
        $image->type = 'image';
        $image->downloads = 0;
        $image->user_id = Auth::id();
        $image->save();

        $lastFile = Cloudfolder::orderBy('id', 'desc')->first();
        return $lastFile;        
        
    }

with implementation above I'm not being able to get the file name instead i'm getting this

/private/var/folders/gn/zn5r8k1d1yxdpz0r0kx0453h0000gn/T/phpHbIKEe

what seems to be the problem ????

nhayder left a reply on How Secure Laravel Is When It Comes To File Upload With Onboard Validation

in case anybody need such secure file uploader, i have made a research regarding this and it looks like the best way to do this in addition to what @bobbybouwmann suggested above, File storage should be outside public folder so if a user was able to upload malicious files they will never be able to to run the script from the browser (in most cases hackers will upload shell script from available file uploader then run script from browser) by hitting the files location endpoint.

shell files mainly looks like this

29384792837492384.php.jpg 

so the file are actually contained in a mime type image/jpeg and you need to make sure to remove unwanted extensions from the file name and make unique code for every stored file on your DB.

UUID something like this domain/923874923749283749234 

on your controller you need to get the file with proper uuid, have a look at @bobbybouwmann suggestion for this issues in our last conversation.

https://laracasts.com/discuss/channels/laravel/how-to-access-image-folder-stored-outside-public-folder

hope this help those who are trying to make secure file management process with laravel.

Thanx

nhayder started a new conversation How Secure Laravel Is When It Comes To File Upload With Onboard Validation

this might be a dump question for some of you but i really need to know how to build a very secure file uploader,

As you know file uploading can be used to upload shell scripts to hack online apps,

so my question is how secure laravel is when it comes to file uploading (images, PDF, .... etc), and will laravel onboard validations do the job of protecting my app from milosuse shell injection ???

25 Feb
2 months ago

nhayder started a new conversation How To Track File Upload Presentation For Customer File Uploader

I'm trying to create a customer file uploader for my app, and i was wondering how can i track the uploaded file percentage to show a progress bar for my uploader

24 Feb
2 months ago

nhayder started a new conversation What Is The Recomended Image Uploader + Cropper For Laravel In 2019

What is the most reliable image uploader + cropper for laravel in 2019

NOTE: im using vue.js

any recommendation

22 Feb
2 months ago

nhayder left a reply on How To Get A File Size

yah, will update you on this, ...

21 Feb
2 months ago

nhayder left a reply on How To Get A File Size

@cronix it looks really complicated :-( there should be an easier way

nhayder left a reply on How To Get A File Size

@SERGIU17 - thank you, i know about php fileSize() i was wondering if there is a way to do the same in laravel? the filesize php function will not get you the mp3 file duration neither video dimensions

nhayder started a new conversation How To Get A File Size

I'm wondering how to get file sizes for these file formats pdf, imag, mp3, zip, video and maybe for video and audio files is there is a way to get the duration and dimensions ???

Any ideas

20 Feb
2 months ago

nhayder left a reply on How To Access Files And Image Stored Outside Public Folder

@bobbybouwmann hey, just to update you, i got it working this time by making an endpoint to return the filename

Route::get('/images/{file}', [ function ($file) {

    $path = storage_path('app/cloudfolder/images/'.$file);

    if (file_exists($path)) {

        return response()->file($path, array('Content-Type' =>'image/jpeg'));

    }

    abort(404);

}]);

and from blade im getting the images like this.

<img src="/images/1234.jpg" />

AND ITS F**ING WORKING GOOOOOD

Thank you for the support

19 Feb
2 months ago

nhayder left a reply on How To Access Files And Image Stored Outside Public Folder

thank you for your support, i will work on this and let you know what happened

Thanks man.

nhayder started a new conversation How To Access Image Folder Stored Outside Public Folder

im storing files and images in cloudfolder stored outside public folder but not sure how to access these files from blade and vue component ???

folder exists on /root/storage/app/cloudfolder

any ideas