Ap3twe

Ap3twe

Member Since 3 Weeks Ago

Experience Points 2,190
Experience Level 1

2,810 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 13
Lessons
Completed
Best Reply Awards 0
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.

16 Apr
6 days ago

Ap3twe left a reply on Images Not Saving To Path When I Update My Database?

@AURAWINDSURFING - I have a storage link working. In the store endpoint. Everything works. Just am updating the table with new image field and is not storing to the folder

15 Apr
1 week ago

Ap3twe started a new conversation Updating A Database Table By Adding New Fields For Image?

My database has images stored. I wanna add a new field with an image. All my updates are working correctly apart from images. I am updating the table inserting an image. When I hit the endpoint, I get the values in the database but the file is not saved in the folder. I will show you how I tried none is working. NB: Saving images to the database I have a working method for adding and retrieving it. The problem is adding a field datatype image to an already created database. Thank you

1 method. I get the name of the files in the database but the path is not in the folder

// Update controller
 public function update(project $project, request $request){

        if ($request->hasFile('lab_quote')){
            // get file Name
            $quotenameWithExt = $request->file('lab_quote')->getClientOriginalName();
            //The image path and name
            $quotefilename = pathinfo($quotenameWithExt, PATHINFO_FILENAME);
             // get the exxtension
            $quoteextension = $request->file('lab_quote')->getClientOriginalExtension();
            // Name append a time stamp
            $labquotefileNameToStore = $quotefilename.'_' .time(). '.' . $quoteextension;
            // Move the file to the folder
            // $stlpath = $request->file('stl_image')->storeAs('public/uploads', $stlfileNameToStore);
            $qtlpath = $request->file('lab_quote')->storeAs('public/uploads/thumbnails', $labquotefileNameToStore);
            // Resize
            $quote = public_path('storage/uploads/thumbnails'. $labquotefileNameToStore);
            $qto = Image::make($_FILES['lab_quote']['tmp_name']);
            $qto->resize('443','313');
            $qto->save($quote);

        }
$project->lab_quote = request('lab_quote');
 $project->save();
10 Apr
1 week ago

Ap3twe left a reply on How Do I Pass 2 Arguments In Foreach ?

@RYANMORTIER - I have achieved that with the application working perfectly. What I am looking for is admin to see each user record projects listed. Strangely I have also achieved looking at each user records one by one. What am looking for is to see all the user records under one page. Now What am encountering is I see all users project no matter the user I click.

Step by step

The admin all users page: all the users are listed perfectly @extends('layout') @section('content')

 <h1 class="text-center m-4"> 
   Doctors Cases  
 </h1>
 <table class="table">
        <thead>
                <tr>
                        <th>Dr Name</th>
                        <th>User Id</th>
                        <th>Email</th>
                </tr>
        </thead>
        <tbody>
   @foreach ($users as $user)
         <tr>
             <td> <a href="/smiledesign/{{$user->id}}/records">{{$user->name}}</a></td>
             <td> <a href="/smiledesign/{{$user->id}}/records">{{$user->id}}</a></td>
             <td> <a href="/smiledesign/{{$user->id}}/records">{{$user->email}}</a></td>
         </tr>

     </tbody>
     @endforeach
 </table>

@endsection


Step 2 The record of each user but gives me all users inrespective of the user I clicks. That is all users projects are listed in each record.

example URL: http://127.0.0.1:8000/smiledesign/1/records
http://127.0.0.1:8000/smiledesign/2/records

 <table class="table table-striped table-bordered" id="table_id">
        <thead>
                <tr>
                        <th>Case Number</th>
                        <th>Case Form</th>
                        <th>Patient Name</th>
                        <th>Date Created</th>
                        <th>Status</th>
                </tr>
        </thead>
        @foreach ($project as $project)
        <tbody>
          
         <tr>
            
             <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->case_number}}</a></td>
            
             @if ($project->services0)
             <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->services0}}</a></td> 
             @elseif ($project->services1)
             <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->services1}}</a></td> 
             @elseif ($project->services2)
             {{-- <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->services2 . '  '  . $project->mockup0}}</a></td>  --}}
             <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->services2 . '  '  . $project->mockup0 . ' ' . $project->mockup1}}</a></td> 

             @endif
             <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->first_name . ' ' . $project->last_name}}</a></td>
             <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->created_at}}</a></td>
             <td> <a href="/smiledesign/{{$project->id}}/userproject">{{$project->concerns}}</a></td> 
         </tr>

     </tbody>
     @endforeach

 </table>


Step 3 It works perfectly from here going When I click a user, I get the correct project. I just want to separate each

Ap3twe left a reply on How Do I Pass 2 Arguments In Foreach ?

@SNAPEY - I am studying along with the forum. I don't think there is a way to achieve expertise without asking questions. If I use find() or first() that means I know the collection I want. What I want to achieve is different

Ap3twe left a reply on How Do I Pass 2 Arguments In Foreach ?

I think am sending every user and projects here. The problem lay here

  public function records(user $users, project $project){
        $project = project::get();
        // $project = auth()->user()->projects;
        $users = user::get();
        dd($project);
        
        return view ('/smiledesign/records' , compact( 'users','project'));
    }

Ap3twe left a reply on How Do I Pass 2 Arguments In Foreach ?

@RYANMORTIER - I get this error

Invalid argument supplied for foreach() (View: C:\laravel\test\resources\views\smiledesign\records.blade.php)

When I change the $user to $users-project , I get

Property [project] does not exist on this collection instance. (View: C:\laravel\test\resources\views\smiledesign\records.blade.php)

Ap3twe left a reply on How Do I Pass 2 Arguments In Foreach ?

@KEL_ - How do I get that particular user?

Ap3twe left a reply on How Do I Pass 2 Arguments In Foreach ?

@KEL_ - The thing is I want only to see one user records. But I get all users record . This is my controller. The admin controller it where am sending the data. I am accessing it as an admin

    public function adminforms (Project $project){
        $users = User::get();
        // $project = Project::where('user_id', auth()->id())->get();
       
     return view('smiledesign.adminforms', compact('users', 'project'));
 }
    // Records
    public function records(user $users, project $project){
        $project = project::get();
        // $project = auth()->user()->projects;
        $users = user::get();
        
        
        return view ('/smiledesign/records' , compact( 'users','project'));
    }

Ap3twe left a reply on How Do I Pass 2 Arguments In Foreach ?

@KEL_ - Not really the spelling. I made the spelling to be like that. I want adding for each $users as $users I get error

Ap3twe started a new conversation How Can I Make Only One Route Public?

Simple as an inline in the web.php

09 Apr
1 week ago

Ap3twe left a reply on What Method Can I Go About This Code - Sending Radio Value And Image To Database?

@SNAPEY - My first choice not to save the image but to make the relationship between the value and image. I am saving the value correctly and getting it back. Now what I want is get the show the image corresponding to the value

Ap3twe left a reply on What Method Can I Go About This Code - Sending Radio Value And Image To Database?

@CRONIX - I get error ""Illegal string offset 'image' " . I dump the variable $imageName I get null

  public function userproject(Project $project, request $request){      
        
        $this->authorize('userproject', $project);
        $imageName = config('smiledesigns.' . $request->smile_design. '.image');
    
        return view ('smiledesign.userproject', compact('project'));
    }

My view

 <div class="col-lg-6 col-sm-6">
            <div class="card text-left" >
                <div class="card-body">
                    <h3> Smiledesign Styles</h3>
                    {{-- <p id="smilestyles">{{$project->smile_design}}</p> --}}
            @foreach (config('smiledesigns') as $key => $data)
             <li><img src="{{ asset('images/' . $data['image']) }} " alt="{{ $data['alt']}} "><br><input type="radio" name="smile_design" value="{{ $key }}"></li>
             @endforeach
                    
            </div>
            </div> 
        </div>

Ap3twe started a new conversation What Method Can I Go About This Code?

I have images and input type radio allowing a user to select one image to the database. The user selects and I get the value. Working perfectly. Now I want to also send the image with the value to the database so I can retrieve the selected image and value to the user record.

This is how I am achieving it. It is part of a form.

<h3> Design Style </h3>
        <p> please select 1 from below </p>
        <br>
        <br>

        <li><img src="{{ asset('images/smileDesign0.png') }} " alt="Keep Same "><br><input type="radio" name="smile_design" value="KeepSame"></li>
        <li><img src="{{ asset('images/smileDesign1.png') }}" alt="Aggressive"><br><input type="radio" name="smile_design" value="Aggresive"></li>
        <li><img src="{{ asset('images/smileDesign2.png') }}" alt="Dominant"><br><input type="radio" name="smile_design" value="Dominant"></li>
        <li><img src="{{ asset('images/smileDesign3.png') }}" alt="Enhanced"><br><input type="radio" name="smile_design" value="Enhanced"></li>
        <li><img src="{{ asset('images/smileDesign4.png') }}" alt="Focused"><br><input type="radio" name="smile_design" value="Focused"></li>
        <li><img src="{{ asset('images/smileDesign5.png') }}" alt="Functional"><br><input type="radio" name="smile_design" value="Functional"></li>
        <li><img src="{{ asset('images/smileDesign6.png') }}" alt="Hollywood"><br><input type="radio" name="smile_design" value="HollyWood"></li>
        <li><img src="{{ asset('images/smileDesign8.png') }}" alt="Mature"><br><input type="radio" name="smile_design" value="Mature"></li>
        <li><img src="{{ asset('images/smileDesign9.png') }}" alt="Oval"><br><input type="radio" name="smile_design" value="Oval"></li>
        <li><img src="{{ asset('images/smileDesign10.png') }}" alt="Softened"><br><input type="radio" name="smile_design" value="Softened"></li>
        <li><img src="{{ asset('images/smileDesign11.png') }}" alt="Vigorous"><br><input type="radio" name="smile_design" value="Vigorous"></li>
        <li><img src="{{ asset('images/smileDesign12.png') }}" alt="Youthful"><br><input type="radio" name="smile_design" value="Youthful"></li> 
       
    ```
08 Apr
2 weeks ago

Ap3twe left a reply on How To Seperate Homestead Projects From Using One Database?

@cronix pls, Another question. I configured host file added homestead.site1, homestead.site. They both are using the same IP address. Do I have to change one? and also when I type in the URL in the browser, it goes to google search. The workaround is using laravel IP 127.0.0.1. That means I can't run projects simultaneously.

Ap3twe left a reply on How To Seperate Homestead Projects From Using One Database?

@CRONIX - Thank you. I followed your advice and am running smoothly

Ap3twe left a reply on How To Seperate Homestead Projects From Using One Database?

@CRONIX - Thank You. I wanted to have each workspace for each project. It might confuse me if I see all the projects in one workspace. , I see migrations in both. I was wondering do I have to change the port? By the way, am using MySQL Workbench

Ap3twe started a new conversation How To Seperate Homestead Projects From Using One Database?

I created a Homestead environment with multiple Projects. I created two instances of MySQL database pointing to the same host and port - DB_HOST=127.0.0.1 DB_PORT=33060. When I migrate each project they migrate to both. How do I separate both?

04 Apr
2 weeks ago

Ap3twe left a reply on How Do I Give Access To One User (admin) To View All Other Peoples Projects?

@WILK_RANDALL - Yes. The variable is pass.

Now how do I see the projects of the particular user. Now I get 404 error coz the url is http://127.0.0.1:8000/design//records

Use how the the double //

Ap3twe left a reply on How Do I Give Access To One User (admin) To View All Other Peoples Projects?

@WILK_RANDALL - It didn't fix it. How do I pass the $project variable to that view. It seems am passing on the user variable to the page

        $users = User::get();
      
     return view('smiledesign.adminforms', compact('users'));
 } ```

The $project is not passing to the view

Ap3twe left a reply on How Do I Give Access To One User (admin) To View All Other Peoples Projects?

@WILK_RANDALL - I have done that am able to have access but I put href arround this ``` {{$user->name}} ``thatt will point to the user all the user projects.

I tried <td> <a href="/smiledesign/{{project->id}}/records">{{$user->name}}</a></td> I get error Undefined variable: project

In the Routes, I tried Route::get('/design/{projects}/records', '[email protected]');

Ap3twe started a new conversation How Do Create A Policy That Gives One User (admin) To View All Other Peoples Projects?

In my app. All users can create a task. The admin can create a task too. The client side is all finish. Now am creating the admin. I have been able to restrict all views that belong to the Admin. How do I enable the Admin to see other users tasks created? I don't want the admin to see the tasks in the same view as the user. I have routes for that. Now I have been able to list all users on a table but when I click a user I see all tasks of all users. I want to see all specific task of the user I click.

I get all users correctly here

//    Admin form case
    public function adminforms (Project $project){
        $users = User::get();
      
     return view('design.adminforms', compact('users'));
 }

Now here I get all projects of all users when I click on the user. I want to only projects from that user not everyone

        $project = project::get();
        return view ('/design/records' , compact('project'));
    }

adminForms View


     <h1 class="text-center m-4"> 
       Doctors Cases  
     </h1>
     <table class="table">
            <thead>
                    <tr>
                            <th>Dr Name</th>
                            <th>User Id</th>
                            <th>Clinic</th>
                    </tr>
            </thead>
            <tbody>
       @foreach ($users as $user)
             <tr>
                 <td> <a href="/smiledesign/records">{{$user->name}}</a></td>
                 <td> <a href="/smiledesign/records">{{$user->id}}</a></td>
                 <td> <a href="/smiledesign/records">{{$user->name}}</a></td>
             </tr>

         </tbody>
         @endforeach
     </table>   
@endsection

Records view

     <table class="table table-striped table-bordered" id="table_id">
            <thead>
                    <tr>
                            <th>Case Number</th>
                            <th>Case Form</th>
                            <th>Patient Name</th>
                            <th>Date Created</th>
                            <th>Status</th>
                    </tr>
            </thead>
            <tbody>
       @foreach ($project as $project)
             <tr>
                
                 <td> <a href="/design/{{$project->id}}/show">{{$project->case_number}}</a></td>
                
                 @if ($project->services0)
                 <td> <a href="/design/{{$project->id}}/show">{{$project->services0}}</a></td> 
                 @elseif ($project->services1)
                 <td> <a href="/design/{{$project->id}}/show">{{$project->services1}}</a></td> 
                 @elseif ($project->services2)
                 {{-- <td> <a href="/design/{{$project->id}}/show">{{$project->services2 . '  '  . $project->mockup0}}</a></td>  --}}
                 <td> <a href="/design/{{$project->id}}/show">{{$project->services2 . '  '  . $project->mockup0 . ' ' . $project->mockup1}}</a></td> 

                 @endif
                 <td> <a href="/design/{{$project->id}}/show">{{$project->first_name . ' ' . $project->last_name}}</a></td>
                 <td> <a href="/design/{{$project->id}}/show">{{$project->created_at}}</a></td>
                 <td> <a href="/design/{{$project->id}}/show">{{$project->concerns}}</a></td> 
             </tr>

         </tbody>
         @endforeach
     </table>
         ```

Ap3twe left a reply on The Best Approach To Use Wsdl In Laravel?

@BOBBYBOUWMANN - The application will need to authenticate through that API and also send data through the API. Will it be possible with the Laravel authentication?

Ap3twe started a new conversation Can I Use One Middleware To Restrict Access To Multiple Routes?

I have an admin access pages I want to restrict. I don't want to create multiple middlewares for the routes.

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

Guys, I found the solution. Assigning the variable to the create project wasn't passing through the name to the database because of the array merge. I assigned the values below the array.

$project =Project::create(array_merge(request(['first_name','last_name','date_wanted','phone_me','phone_num','fee_quote0','fee_quote1','services0','services1', 'services2', 'photo_image', 'stl_image', 'mockup0','mockup1', 'category0','category1','category2','concerns0','concerns1','concerns2','concerns3','concerns4','concerns5',
 'smile_design','doctors_note', 'user_id',
      
         ]),
        //  Below I have used array_merge to store the user id, photo and stl 
         ['user_id' => auth()->id(),
         'photo_image' => $fileNameToStore,
         'stl_image' => $stlfileNameToStore,
          ]));

Thank you all, I learnt alot

03 Apr
2 weeks ago

Ap3twe left a reply on Where Are You All From?

Vancouver, Canada

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

@JLRDW - @jlrdw I had coded your method in the chrome dev tools, and it works. <img class="card-img-top" src="http://127.0.0.1:8000/uploads/image3.png" alt="">

In the blade, the row_name when I put a filename inside <img src="{{ asset('uploads') . '/' . $project->dogs }}" alt="" class="your_css"> It retrurns empthy.

Ap3twe started a new conversation The Best Approach To Use Wsdl In Laravel?

I am not familiar with Soap. We have an API built in .net Wisdl. I am building a project with Laravel. What is the best approach? The API is for authentication, receives a task from a user and registers into our CPM. Any starting guide will be helpful.

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

@JLRDW - I tried your code. It works like mine but still pointing to a temp file.

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

Guys I think am doing something wrong. I am putting the code here. If anyone of you can edit it to the correct location.

    public function store(Project $project, Request $request){        
        
   {
    
     //    Patient Form validate
        request()->validate([
            'first_name'=> ['required', 'min:3'],
            'last_name'=> ['required', 'min:3'],
            'date_wanted'=> 'required',
            'photo_image' => 'required',
            'stl_image' => 'required',
            'smile_design' => 'required'       
        ]);
    
   }   
//   I have used array_merge to store the user id
        //    Patient Form send to database
 $project = Project::create(array_merge(request(['first_name','last_name','date_wanted','phone_me','phone_num','fee_quote0','fee_quote1','photo_image','stl_image','services0','services1', 'services2','mockup0','mockup1', 'category0','category1','category2','concerns0','concerns1','concerns2','concerns3','concerns4','concerns5',
 'smile_design','doctors_note', 'user_id',
         ]),
        
         ['user_id' => auth()->id()]));
    if ($request->hasFile('photo_image')){
        $image = $request->file('photo_image');
        $name = $image->getClientOriginalName();
        $size = $image->getClientSize();
        $destinationPath = public_path('/uploads');
        $image->move($destinationPath, $name);
        
    }

  if ($request->hasFile('stl_image')){
        $stl = $request->file('stl_image');
        $stlname = $stl->getClientOriginalName();
        $stlsize = $stl->getClientSize();
        $stldestinationPath = public_path('\uploads');
        $stl->move($stldestinationPath, $stlname);
        
    }
     ```
 ``` event(new ProjecthasCreated($project));
      return redirect ('/smiledesign/success')->with('created_id', $project->id);
    }

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

@SNAPEY - stl_image cant be saved there, it gives me syntax error

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

@SNAPEY - @snapey Which location are you talking of. I tried to put the files here

              
             'first_name',
             'last_name'
             'phone_num',
             'photo_imag',
             'user_id'
         ]),
         ['user_id' => auth()->id()]));

    if ($request->hasFile('photo_image')){
        $image = $request->file('photo_image');
        $name = $image->getClientOriginalName();
        $size = $image->getClientSize();
        $destinationPath = public_path('/uploads');
        $image->move($destinationPath, $name);
        
    }

      event(new ProjecthasCreated($project));
      return redirect ('/smiledesign/success')->with('created_id', $project->id);
    } ```

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

@JLRDW - @jlrdw

  1. When I dump in my store controller, the files point to the correct location "C:\laravel\test\public\uploads"

  2. The files are physically present in the folder

  3. In my view, when I call the <img class="card-img-top" src="{{ asset($project->stl_image)}}" alt="">, the page does not show.

  4. When I dump $projects in the show controller, I get this in the attributes "photo_image" => "C:\xampp\tmp\phpB0C1.tmp" "stl_image" => "C:\xampp\tmp\phpB0C2.tmp"

Please, how do I implement your suggestion? show me the steps and where I should put the lines

NB: I am not using Xampp, I am using Homestead

02 Apr
2 weeks ago

Ap3twe left a reply on Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

Oh, I see I am using homestead. That will be another challenge

Ap3twe started a new conversation My Uploaded Files Is Not Retrievable To The View Because The Path Is Pointing To A Temp Folder.

I can see the physical files in the correct folder but cant show it to the view. When I dd ($projects) in my show view, I get

    "stl_image" => "C:\xampp\tmp\php6BE2.tmp" ```

Here is my show view controller

```  public function show(Project $project){      
        
        $this->authorize('show', $project);
     
        return view ('boka.show', compact('project'));
    } ```


Store controller

``` public function store(Project $project, Request $request){        
        
   {
    
       //    Patient Form validate
        request()->validate([
            'photo_image' => 'required',
            'stl_image' => 'required',
       
        ]);
    
   }   ```

  ```if ($request->hasFile('stl_image')){
    $stl = $request->file('stl_image');
    $stlname = $stl->getClientOriginalName();
    $stlsize = $stl->getClientSize();
    $stldestinationPath = public_path('/uploads');
    $stl->move($stldestinationPath, $stlname);
 }```

``` $project = Project::create(array_merge(request([
             'first_name',
             'last_name',
             'photo_image',
             'stl_image',
             'user_id'
         ]),
         ['user_id' => auth()->id()])); 

         event(new ProjecthasCreated($project));
      return redirect ('/boka/success')->with('created_id', $project->id);
    } ```

Ap3twe left a reply on How Do I Retrieve Image From Database To Show In View?

@BOBBYBOUWMANN - I fixed it. I followed the instructions. But the weird thing is it didn't work till the next day. Thank you. I appreciate

01 Apr
3 weeks ago

Ap3twe left a reply on How Do I Retrieve Image From Database To Show In View?

@BOBBYBOUWMANN - Still not there after removing the dd(username). Do you think how I saved it in the database is the problem? I saved it as blob datatype.

Ap3twe left a reply on How Do I Retrieve Image From Database To Show In View?

@BOBBYBOUWMANN - The error is passed. I checked the public\images folder I didn't see the image file. How can I see it. Also I am retrieving the file in my view like :

<h6>Photos</h4> <img class="card-img-top" src="{{$project->photo_image}}" alt="">

Ap3twe started a new conversation How Do I Retrieve Image To Show In View?

A newbie I have stored images in a database. I want to save it to a public/images directory and retrieve it to a user page view. The code below breaks with an error Undefined variable: request . I changed request to $project and get an error BadMethodCallException Call to undefined method App\Project::hasFile()

public function store(project $project){

{

   //    Patient Form validate
    request()->validate([
        'first_name'=> ['required', 'min:3'],
        'last_name'=> ['required', 'min:3'],
        'date_wanted'=> 'required',
        'photo_image' => 'required',
        'stl_image' => 'required',
        'sdes_design' => 'required'       
    ]);

}

    //    Patient Form send to database

$project = Project::create(array_merge(request([

         'first_name',
         'last_name',
         'date_wanted',       
         'phone_me',
         'phone_num',
         'fee_quote0',
         'fee_quote1',
         'photo_image',
         'stl_image',
         'services0',
         'services1',
         'services2',
         'mockup0',
         'mockup1',
         'category0',
         'category1',
         'category2',
         'concerns0',
         'concerns1',
         'concerns2',
         'concerns3',
         'concerns4',
         'concerns5',
         'des_design',
         'doctors_note', 
         'user_id'
     ]),
    //  on top I have used array_merge to store the user id
     ['user_id' => auth()->id()]));

 
if ($request->hasFile('photo_image')){
    $image = $request->file('photo_image');
    $name = $image->getClientOriginalName();
    $size = $image->getClientSize();
    $destinationPath = public_path('/images');
    $image->move($destinationPath, $name);
    $userImage = new UserImage;
    $userImage->name = $name;
    $userImage->size = $size;

    dd($userImage);
    $userImage->save();

}
   

  event(new ProjecthasCreated($project));
  return redirect ('/design/success')->with('created_id', $project->id);
}