louis12

louis12

Member Since 1 Month Ago

Experience Points
580
Total
Experience

4,420 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
3
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
580 XP
May
24
2 days ago
Activity icon

Replied to Dropzone Upload Paths And Name Attributes.

Alright, thank you. If I had to use the below code once for each image that are being uploaded, could you please advise on how I could then assign a name attribute for each image in my Dropzone view page?

 public function store(Request $request)
    {
        $image = $request->file('image1');
        $avatarName = $image->getClientOriginalName();
        
        $image->move(storage_path('app/public/image1'),$avatarName);
        $imageUpload = new Image();
        $imageUpload->filename = $avatarName;
        $imageUpload->save();
        return response()->json(['success'=>$avatarName]);
    }
Activity icon

Replied to Dropzone Upload Paths And Name Attributes.

@bobbybouwmann Thank you for the reply. I used the below code multiple times (for image2, image3, image4 etc.) in order to store each image with a different path in the database. Could you please advise on how I could assign different paths to each image using Dropzone?

// Handle file upload
 if($request->hasFile('image2')){
    //Get filename with extention
        $filenameWithExt = $request->file('image2')->getClientOriginalName();
    // Get filename only
        $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
    // Get xetention only
        $extention = $request->file('image2')->getClientOriginalExtension();
    // Filename to Store
        $fileNameToStore2 = $filename.'_'.time().'.'.$extention;
    // Upload Image
        $path = $request->file('image2')->storeAs('public/image2', $fileNameToStore2);
     } else {
        $fileNameToStore2 = 'noimage.jpg';}


// Handle file upload
if($request->hasFile('image3')){
    //Get filename with extention
        $filenameWithExt = $request->file('image3')->getClientOriginalName();
    // Get filename only
        $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
    // Get xetention only
        $extention = $request->file('image3')->getClientOriginalExtension();
    // Filename to Store
        $fileNameToStore3 = $filename.'_'.time().'.'.$extention;
    // Upload Image
        $path = $request->file('image3')->storeAs('public/image3', $fileNameToStore3);
     } else {
        $fileNameToStore3 = 'noimage.jpg';}
May
23
3 days ago
Activity icon

Replied to Dropzone Upload Paths And Name Attributes.

@bobbybouwmann Thank you for your reply. The application currently has a "create page" with a few individual image upload inputs, in order for a user to add images when creating a new property (post). I I would like to remove the individual image upload inputs and rather direct a user to another page (after creating a new property), where they can then use Dropzone in order to upload the images for that respective property (post). Could you perhaps please advise on how I could assign the images (using Dropzone) to the respective property (post)?

Activity icon

Replied to Dropzone Upload Paths And Name Attributes.

@bobbybouwmann Thank you for the reply. I have tried to change the upload path in the Controller (as below), but are not sure about the code and syntax. Any assistance would be appreciated.

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Image;
use Illuminate\Support\Facades\Storage;
use Auth;
use App\Property;
use App\User;
use DB;


class ImageController extends Controller
{

    public function store(Request $request, $id)
    {
        
        $property = Property::findorFail($id);
        
    	$image = $request->file('file');
        $avatarName = $image->getClientOriginalName();
        $image->move(storage_path('app/public/images' . $property, $avatarName);
         
        $imageUpload = new Image();
        $imageUpload->filename = $avatarName;
        $imageUpload->save();
        return response()->json(['success'=>$avatarName]);
    }
}
Activity icon

Started a new Conversation Dropzone Upload Paths And Name Attributes.

Good day,

I am trying to replace individual file / image upload fields with Dropzone. After adding the Dropzone code, the images are now uploading to an individual folder: (storage_path('app/public/images')

Could someone please advise on how I could assign different upload paths for each listing (post), as well as how I could assign a different name attribute to each image ( in order to store the image names in different columns in the database)?

Please find the code below.

View file:

 <form method="post" action="{{ route('dropzone.store') }}" enctype="multipart/form-data"
          class="dropzone" id="dropzone">
        @csrf
        </form>
    </div>
    <script type="text/javascript">
        Dropzone.options.dropzone =
        {
            maxFilesize: 10,
            renameFile: function (file) {
                var dt = new Date();
                var time = dt.getTime();
                return time + file.name;
            },
            acceptedFiles: ".jpeg,.jpg,.png,.gif",
            addRemoveLinks: true,
            timeout: 60000,
            success: function (file, response) {
                console.log(response);
            },
            error: function (file, response) {
                return false;
            }
        };
    </script>

Controller:


class ImageController extends Controller
{
    public function index()
    {
    	return view('image');
    }

    public function store(Request $request)
    {
    	$image = $request->file('file');
        $avatarName = $image->getClientOriginalName();
        $image->move(storage_path('app/public/images'),$avatarName);
         
        $imageUpload = new Image();
        $imageUpload->filename = $avatarName;
        $imageUpload->save();
        return response()->json(['success'=>$avatarName]);
    }
}
May
14
1 week ago
Activity icon

Replied to Error When Trying To Create A Symlink On Server.

@snapey Thank you! It worked after executing the script below:

<?php

$targetFolder = '/home2/property/findingproperty/storage/app/public';
$linkFolder = '/home2/property/public_html/storage';
symlink($targetFolder,$linkFolder);
echo 'Symlink process successfully completed';

?>
May
13
1 week ago
Activity icon

Replied to Error When Trying To Create A Symlink On Server.

@michaloravec Thank you for the reply. I have executed the suggested code. A link called "storage" was created in: homedirectory/public_html/public, but the images still doesn't display on the front end. The path to the images in the blade view are:

src="/storage/cover_images/{{$property->cover_image}}"

The images does however display on the front end when manually placing them in the directory: homedirectory/public_html/storage.

Activity icon

Replied to Error When Trying To Create A Symlink On Server.

@snapey Thank you for your reply. I have tried to create a link by executing the below code. It creates a link in the public_html folder called "storage", but the images that are stored in the path: homedirectory/findingproperty/storage/app/public/cover_images are still not displaying on the front end. I am not sure whether the target folder path and the link folder path in the code are set correct though.

<?php

$targetFolder = $_SERVER['DOCUMENT_ROOT'].'/storage/app/public';
$linkFolder = $_SERVER['DOCUMENT_ROOT'].'/storage';
symlink($targetFolder,$linkFolder);
echo 'Symlink process successfully completed';

?>
Activity icon

Started a new Conversation Error When Trying To Create A Symlink On Server.

Good day,

I have been trying to create a symlink between the storage/app/public folder and the storage folder that are located in the public_html directory. I am currently making use of a shared hosting plan and currently do not have access to a terminal on the server. I have tried to create a symlink by executing the below route, but are receiving the error:

ErrorException symlink(): No such file or directory

Route::get('/foo', function () {
    Artisan::call('storage:link');
});

Any assistance would be appreciated.

Apr
12
1 month ago
Activity icon

Replied to Adding Images Inside A Html Email Template.

Thank you very much. The syntax error are removed and the specific image / profilepicture are now displaying in the emails. Thank for the help - much appreciated.

Activity icon

Replied to Adding Images Inside A Html Email Template.

@snapey Thank you for the reply. I managed to display the default image in the browser by using the code below:

<img src="{{ asset('/storage/profilepictures/default.jpg') }}">

The image however still doesn't appear in the email. Also not sure how to display a specific / dynamic profile picture in the browser or email as the below code does't work:

<img src="{{ asset('/storage/profilepictures/{{$data ['userprofilepicture'] }}') }}">

Apr
11
1 month ago
Activity icon

Replied to Adding Images Inside A Html Email Template.

It seems like it is only sending the file name from the database and not the path where the images are stored.

Activity icon

Replied to Adding Images Inside A Html Email Template.

The html code in the received email are: ...img src="1586354319.jpg">

Activity icon

Replied to Adding Images Inside A Html Email Template.

@georgiosweller thank you for the reply. I have tried the suggested code, but the image are for some reason still not pulling through / displaying in the email. The below code are displaying in the received email, but no image are displaying:

Activity icon

Replied to Adding Images Inside A Html Email Template.

Hidden field in the form that are being submitted:

name="userprofilepicture" value="{{$property->user->profilepicture}}">

Activity icon

Started a new Conversation Adding Images Inside A Html Email Template.

Could someone please advise on I could add images to a html email template?

Would like to include a user's profile picture in the email template. The different image / file names are stored in the database and the images are stored in the: storage/profilepictures folder. When I render the code below, the file name appears in the email, but not sure how to get the image to appear in the email. Assistance would be appreciated.

When rendering the below, the file name in the database are being displayed in the email:

{{$data ['userprofilepicture']}}
        

This is in the controller:

public function store()

{

$data = request()->validate ([ 'name' => 'required', 'lastname' => 'required', 'subject' => 'required', 'email' => 'required|email', 'message' => 'required', 'email2'=>'', 'userprofilepicture'=>'',

]);

Mail::to(request('email2')) ->send(new ContactFormListing1($data));

Mail::to(request('email')) ->send(new ContactFormListing2($data));

return back() ->with ('success', 'Thank you. Your meassage has been sent'); }

And this is in the view / form that are being submitted: