Director at Novate Ltd

Member Since 6 Years Ago

Mansfield

Experience Points
2,196,545
Total
Experience

0 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
1442
Lessons
Completed
Best Reply Awards
3084
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.

  • Community Pillar

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

Level 50
2,196,545 XP
Apr
16
17 hours ago
Activity icon

Replied to PUT Creates A New Item

does your route accept an id?

does the form send the id?

Activity icon

Replied to Should We Use The .env File In Production As Well, And How To Protect It

I always use .env

I always make sure that only the public folder can be accessed from the outside.

Activity icon

Replied to PUT Creates A New Item

then you need to pass in the ID of the record to be updated or use route model binding and have Laravel get the right record for you.

This is basics.... perhaps 0 lessons completed is a clue

Activity icon

Replied to Dynamically Create A Folder In A Public Storage Disk

open tinker, type

>>> config('filesystems')

and then paste the result

Activity icon

Replied to Dynamically Create A Folder In A Public Storage Disk

@wakanda

this won't work, each time you call uniqid it will return a different value

 while (Storage::disk('report_upload')->exists($name . '.xlsx')) {
            $name .= $counter;
            $counter++;

        $newdir = 'Reportes-' . uniqid();

            Storage::disk('report_upload')->makeDirectory($newdir);
        }

        Excel::store(new SurveyReport($items), $name . '.xlsx',  'report_upload/'. $newdir);
Activity icon

Replied to PUT Creates A New Item

What's your question?

Activity icon

Replied to How To Correctly Draw Up A Form When Filling Out An Entry?

You seriously need to watch some videos or read some articles. There are loads of free lessons here and on Youtube. I see you have done just one.

Activity icon

Replied to Dynamically Create A Folder In A Public Storage Disk

you are using $request->request_time but this includes characters that are not valid for use in a folder name.

Activity icon

Replied to Diagnosing Queue MaxAttemptsExceededException Errors

I had assumed that a function called from a job would inherit the jobs timeout but maybe not?

It does

Activity icon

Replied to How To Correctly Draw Up A Form When Filling Out An Entry?

function store(Request $request)
    {
        $this->validate($request, [
            'name'=>'required',
            'description'=>'required'
        ]);


        $post = Post::query()->create(
            'name ' => $request->name,
            'description' => $request->description,
        );

        foreach($request->stores as $store) {

            $post->stores()->create([
                'store_name' => $store['store_name'],
                'store_link' => $store['store_link'],
             ]);

        }
        return redirect()->route('posts.index');
    }

and you have to make sure that all mentioned fields are in the $fillable array on the models

Activity icon

Replied to How To Correctly Draw Up A Form When Filling Out An Entry?

It's name function in model Post.

public function getNameStoreForPost()
{
    return $this->hasMany(Store::class);
}

Then it ought to be called stores and then it would be obvious what the code was trying to do

Activity icon

Awarded Best Reply on My Edit Page Outputs An Empty Array

your function needs to accept the same name as the resource

Your resource route is allartworks so the parameter passed to the show method should be allartwork

Confirm this by looking at php artisan route:list

you will see the resource name.

So. probably something like;

public function show(Artwork $allartwork)
{
    return $allartwork;
}
Activity icon

Replied to How To Correctly Draw Up A Form When Filling Out An Entry?

validate all the data, write it to the models

there's not really much more to it than that.

Just passing $request->all() tells me you have not really thought about it

Also, if you want to add more rows with the same name then your form fields naming needs to include array syntax

   <div>
        <label>Links</label>
            <input type="text" name="stores[]store_name">
            <input type="text" name="stores[]store_link">
    </div>

and then the same in your javascript

Activity icon

Replied to Diagnosing Queue MaxAttemptsExceededException Errors

are you calling some third party api?

you could add a try-catch block around the code in your job and then you will get control of there is an error and can then dump relevant logging

Activity icon

Replied to Diagnosing Queue MaxAttemptsExceededException Errors

you could temporarily add more logging to the job and then check in the laravel logfile later?

Apr
15
1 day ago
Activity icon

Replied to My Edit Page Outputs An Empty Array

but, why do you have both

Route::resource('artworks', 'ArtworkController');
Route::resource('allartworks', 'AllArtworkController');
Activity icon

Replied to My Edit Page Outputs An Empty Array

your function needs to accept the same name as the resource

Your resource route is allartworks so the parameter passed to the show method should be allartwork

Confirm this by looking at php artisan route:list

you will see the resource name.

So. probably something like;

public function show(Artwork $allartwork)
{
    return $allartwork;
}
Activity icon

Replied to My Edit Page Outputs An Empty Array

what does the route look like?

Activity icon

Replied to Dropzone With Laravel

Media Library and Media Library Pro are different things.

Activity icon

Replied to Does A Spy Have To Be A Partial?

Whats a spy?

Activity icon

Replied to Where Between Not Working As Expected

messing with casts is not going to make any difference if the column is not in a datetime format

Activity icon

Replied to Blade + Empty Relationship

or use the optional helper, or a default model

https://laravel.com/docs/8.x/helpers#method-optional

https://laravel.com/docs/8.x/eloquent-relationships#default-models

personally I use null coalesce whenever I have two arrows in a view

Activity icon

Replied to Gmail Is Changing <a Href"" To Wrong Link

check what the original email contains. Google can't just invent a subdomain

Activity icon

Replied to Laravel(8) Queue, Crash To Server Error 500, Because Wrong Instance.

in your job constructor you have said it's only acceptable to pass a Pros model

public function __construct(Pros $pros)
Activity icon

Replied to How To Modify Spatie Role And Permission?

you n have a look around my project here which is public

https://github.com/snapey/r4fb

In this the permissions are hard coded because they need to be used within the various controllers and views. Having a way to create permissions through the UI would be pointless because none of the functions are checking for that new permission

But the admin can create new roles and say what permissions are allowed within that new role. Since access control is only done through permissions the name of the role can be anything the admin likes it is only used to confer a set of permissions

Activity icon

Replied to Laravel8 Errors

usually a permissions issue

Activity icon

Replied to Gmail Is Changing <a Href"" To Wrong Link

outlook and google obfuscate links in urls to stop you being able to click them directly. This is so that they can block the link if they need to because it turns out dangerous

https://support.google.com/mail/answer/10173182?hl=en-GB&ref_topic=3394657

Apr
14
2 days ago
Activity icon

Replied to Error Object Of Class StdClass Could Not Be Converted To String

so the last line of your code in the stack trace is SubscriptionController.php at line 60

what code is that?

Activity icon

Replied to Laravel Is Adding <br> To My Page Source

Have you done anything with language translation files?

Activity icon

Replied to Laravel Is Adding <br> To My Page Source

Rest assured there is no such setting.

What is in the view file ?

What editor have you used on the code?

Activity icon

Replied to Prevent To Loaded One To One Relationship On "Laravel API Resource"

I don't know if you understood my question

Clearly you have a recursive loop which is usually caused by two models both automatically eager loading the other by use of $with statements in each model

Activity icon

Replied to Create Method

the first method fills the model with an array and therefore counts as mass assignment so all of the fields mentioned must be fillable or the model unguarded

The second method assigns the values individually so does not care about mass assignment

Also, in the first method you assign to a property called $id but in the second you do not

You also show two different methods of accessing the request variables. both are valid, and as shown, they work the same

Your model is called Products. You will get along with other developers better if you stick to singular names for models

Your primary key appears to be called prod_id which is also a break from conventions and will mean extra work when defining relations

I would say both methods are ok for your first month in coding

A more professional developer would probably pass only validated data into the model

Apr
13
3 days ago
Activity icon

Replied to Attempt To Read Property "id" On Null .

... and why are you returning a view from a repository?

Activity icon

Replied to Error Object Of Class StdClass Could Not Be Converted To String

why not show the actual error including the line of code?

Activity icon

Replied to Avoid HTML Closing Tag When Generating HTML From Blade

But Laravel generates also closing tag:

it won't be creating the closing tag, but your browser will show it where it is assuming it is closed when you view in the developer tools. If you view the actual source your html would be invalid because the tag is not closed.

Activity icon

Replied to Problem With Laravel App With Server Connection Production

There is no problem developing in a windows environment but really you should deploy to a unix server for production.

Activity icon

Replied to Echoing Form Fields From Db

what does the data look like in the database? Your question does not make any sense at the moment.

Activity icon

Replied to Intervention Image And FilePond

@yadav2brand post your own question with your own scenario

Activity icon

Replied to Intervention Image And FilePond

WHAT error?

"same error" is absolutely no use for diagnosing the problem

Activity icon

Replied to Problem With Laravel App With Server Connection Production

You just need to learn how to deploy on a web server like apache or nginx. I could not tell what OS your IONOS server uses, but really you should be using Linux.

Activity icon

Replied to Long URLs With Many GET Vars In Big Websites, !!!!

why not? Its their business to track your every move.

Activity icon

Replied to How To Load View Part By Part In Laravel?

I have never built an application that needs 16 seconds to draw the view. Thats ridiculous

Activity icon

Replied to Intervention Image And FilePond

This line

$file->move("uploads/" .,$name_gen);  

and this line

->move(uploads/" . $name_gen);

are both invalid php syntax

LOOK in the logfile

Activity icon

Replied to Getting Data From A Foreing Key Laravel7

@laithalenooz use get() instead of all() when eager loading

Activity icon

Replied to How To Load View Part By Part In Laravel?

do you have millions of students? A database query should not take that long, but you hint at filtering and reorganising the data in php?

Activity icon

Awarded Best Reply on Getting Data From A Foreing Key Laravel7

seems to me like it's more likely that product belongs to sector?

Anyway to get it working

-rename the column to product_id and add an id column to the sectors table. remove the primary key statement in the model

eager load sector

public function index()
    {
       $products = Product::with('sector')->get();
       return view('worker.index', compact('products'));
    }

in the view use $product->sector->field ?? 'no sector'

your relation is called sector not sectors

the null coalesce operator ?? handles the case where a product is missing its sector

Community Pillar

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