RaymondE

RaymondE

Member Since 1 Year Ago

Experience Points 820
Experience Level 1

4,180 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 4
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

17 May
1 month ago

RaymondE started a new conversation Webmix | all Files In Folder In Single Outputs

Hi there,

i've been searching on google but i cant find the solution i'm looking for.

My app will run on the http/2 protocol, so i would like to have multiple css files. My goal is that only the css that is needed should be loaded, depending on what site type the user is on.

Now... i don't want to add every resource manually to my webpack config file.

Is their a way to setup webpack that it will search for all files in a folder (and subfolders) and output them to single files?

my folder structure: frontend

  • app.scss -- pages ---_city.scss ---_dashboard.scss ---_post.scss --modules ---_forms.scss ---_navigation.scss

my output that i want: .../app.css .../city.css .../dashboard.css .../post.css .../forms.css .../navigation.css

THANKS :)

20 Feb
4 months ago

RaymondE started a new conversation Code Shortcut For Route Function With Multiple Parameters

Hi guys,

i have a piece of code that i use in multiple parts of my app. I believe there is a way more elegant way to display my code.

So i have this route:

Route::get('/{country}/{city}/{post}', [PostController::class, 'show'])->name('show');

My Post.php Model is connected to Country.php, as well as City.php

My application also uses dynamic language subdomains e.g. en.domain.com & de.domain.com. The Language.php Model is shared with every view, so i can get access to the Model via $language.

While building my templates in Blade i always have a really long functions to access the correct link.

{{ route('frontend.post.show', [ $post->country()->where('language_id', $language->id)->first(), $post->city()->where('language_id', $language->id)->first(),  $post]) }}

Is there any way i can simplify my code?

Thanks :)

Ray

10 Jan
6 months ago
09 Jan
6 months ago

RaymondE left a reply on Get Nearby Places Google API

Thanks for the answers, they are helping me find a solution!

This is how i would set up my project now:

User types in location -> Google API gets all nearby cities/villages from this location in a certain range and puts them in a array -> This array is then matched with all my entries

Would this be a performance issue? I have planed to have more than 1.000 entries and a "nearby" array could have 20 or 40 city/villages.

Or would it be easier to calculate the distance based on the coordinates, like @hdsavani suggests?

Thanks guys!

08 Jan
6 months ago

RaymondE started a new conversation Get Nearby Places Google API

Hi guys,

i don't know how to program something :)

I'm creating a type of a dictionary that includes places.

Similar like this website https://bit.ly/2CWsAgz

How can i program that the nearby entries are found?

The customer journey should be that they enter a location and find all nearby results?

Thanks!

Ray

29 Mar
1 year ago

RaymondE left a reply on Spati MediaLibrary Not Saving Images

man these beginner mistakes are really annoying^^

Thanks guys, this was the part that was missing :)

RaymondE left a reply on Spati MediaLibrary Not Saving Images

I think so, yes.

{!! Form::open(['action' => '[email protected]', 'method' => 'POST', 'files' => true]) !!}
    
      <div class="file-field input-field">
      <div class="btn">
        <span>Background</span>
        {{Form::input('file', 'background')}}
      </div>
      <div class="file-path-wrapper">
        <input class="file-path validate" type="text">
      </div>
    </div>

    <button class="btn waves-effect waves-light" type="submit" >Speichern
        <i class="material-icons right">send</i>
    </button>

{!! Form::close() !!}
            

RaymondE started a new conversation Spati MediaLibrary Not Saving Images

Hello,

i'm quite new to laravel and have an issue where i'm kinda stuck.

I'm using the MediaLibrary package from spatie and i'm trying to store an image that has beeen uploaded.

Everything works fine, expect that the image is not stored and no recored is placed in the database.

Maybe someone can help me out.

Thanks!

MediaController

<?php

namespace App\Http\Controllers;


use App\Media;
use Illuminate\Http\Request;

class MediaController extends Controller
{

    // Hintergrund Polygon hinzufügen
    public function addBackgroundImage(Request $request)
    {
     
     // Media::create()
     //         ->addMediaFromRequest('background')
     //         ->toMediaCollection();


        $media = new Media;

        $media->addMediaFromRequest('background')
              ->toMediaCollection('backgrounds');

        return redirect('/settings')->with('success', 'Hintergrund Bild hinzugefügt');
    }

}

Model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
use Spatie\MediaLibrary\HasMedia\HasMedia;

class Media extends Model implements HasMedia
{
        use HasMediaTrait;

}

Thanks!

23 Mar
1 year ago

RaymondE left a reply on Method Not Found | Spatie Media Library

Hi m-rk,

what is the best practise to take an request and add it to the toMediaCollection?

i'm referring to

The only thing is is that your $media object will be null. So you should first sort that out.

Thanks!

RaymondE left a reply on Method Not Found | Spatie Media Library

Hi m-rk,

thanks, your recommendation worked! I think i even understand my mistake now :)

BTW, laravel-news.com posted a tutorial on this today: https://laravel-news.com/uploading-avatar-images

What nice coincident!

RaymondE left a reply on Method Not Found | Spatie Media Library

Hi rin4ik,

i thought $this was related to the parameter in the function. I changed this like you said and now i have a different error referring to the same issue.

"Method Illuminate\Database\Query\Builder::toMediaCollection does not exist."

Thanks for the help!

RaymondE started a new conversation Method Not Found | Spatie Media Library

Hi there, i'm quite new to Laravel but i'm learning fast. I now came across a problem where i've been stuck ever since.

I want to add the Media Library from Spatie to my system (https://docs.spatie.be/laravel-medialibrary/v7/introduction)

I think i have everything set up correctly but somehow it cant find the functions referring to the media library package.

Here are my files:

Media.php


namespace App;

use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
use Spatie\MediaLibrary\HasMedia\HasMedia;

class Media extends Model implements HasMedia
{
        use HasMediaTrait;


}

MediaController.php


namespace App\Http\Controllers;


use App\Media;
use Illuminate\Http\Request;

class MediaController extends Controller
{

    // Hintergrund Polygon hinzufügen
    public function addBackgroundImage(Media $media = null)
    {

        $this  ->  toMediaCollection('background')
            ->fit(Manipulations::FIT_FILL, 1920, 500);

        return redirect('/settings')->with('success', 'Hintergrund Bild hinzugefügt');
    }

}

Web.php (only the routes regarding this issue)

Route::get('/settings/', '[email protected]');
Route::post('/settings', '[email protected]')->name('background.store');

settings.blade.php (only the form)

{!! Form::open(['action' => '[email protected]', 'method' => 'POST']) !!}
    
      <div class="file-field input-field">
      <div class="btn">
        <span>Background</span>
        {{Form::input('file', 'background-image')}}
      </div>
      <div class="file-path-wrapper">
        <input class="file-path validate" type="text">
      </div>
    </div>

    <button class="btn waves-effect waves-light" type="submit" >Speichern
        <i class="material-icons right">send</i>
    </button>

{!! Form::close() !!}

Error Message

BadMethodCallException Method App\Http\Controllers\MediaController::toMediaCollection does not exist.

I dont understand why it's not finding the method. I included it to the Model, so the Controller should be able to reach the methods from the library.

I would be really thankfull for any help :)

Cheers, Ray