s4muel

s4muel

Member Since 3 Years Ago

Experience Points
83,320
Total
Experience

1,680 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
495
Lessons
Completed
Best Reply Awards
57
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 17
83,320 XP
Sep
08
1 week ago
Activity icon

Replied to Error :PDOException: SQLSTATE[HY000]: General Error: 1366 Incorrect String Value: '\xD8' For Column 'about_ar'

whats your character set on that column? try setting it to utf8mb4

Aug
19
1 month ago
Activity icon

Replied to Subcategories Fields Are Not Showing.

is your route correct? you call /getStates/ in the ajax, and the method to get subcategories is named getSubCat($id)

something like this

Route::get('/getStates/{id}', '[email protected]');
Activity icon

Awarded Best Reply on Seeder Not Working (cannot Find ::setContainer() Method)

edit the DatabaseSeeder like this:

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        $this->call([
           WorkerTypeSeeder::class //here you need the seeder class, not the model class
        ]);
    }
}
Aug
18
1 month ago
Activity icon

Replied to Seeder Not Working (cannot Find ::setContainer() Method)

edit the DatabaseSeeder like this:

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        $this->call([
           WorkerTypeSeeder::class //here you need the seeder class, not the model class
        ]);
    }
}
Aug
11
1 month ago
Activity icon

Replied to Passing Id From Blade When Using Inject

like this?

<input type="text" class="form-control" id="serverKey" name="serverKey" value="{{$site::brandNewSite('serverKey')}} ">

you know the id, so just pass it in. if it is generated/manipulated on the client site (browser, using JS for example), you can't pass it in, because it is too late, the blade is render on server.

Aug
10
1 month ago
Activity icon

Replied to Automatically Pass Foreign Key When Create From Relationship

$user = User::create([
            'firstname' => 'John',
            'lastname' => 'Doe',
            'email' => '[email protected]',
            'password' => bcrypt('password')
        ]);
$holding = new Holding(['reference' => Str::uuid()]);

$user->holding()->save($holding);
Activity icon

Awarded Best Reply on Markdown Issues With Laravel 7

i would try removing the graham-campbell/markdown completely and start over. remove package, install package, publish all vendor assets. if you use the @markdown directive, there is no need to enable the "view integration" and to use .md* in names, but it doesnt hurt

and since we are talking about laravel 7, you shouldnt need to register the service provider in the config/app.php, automatic package discovery should handle that.

Aug
09
1 month ago
Activity icon

Awarded Best Reply on Windows, VSCode, Blade Highlight Scheme

since i installed rainglow extension (https://rainglow.io/) to vscode , i am very happy with it. i just checked, there are some dark themes you might like. give it a try.

Aug
07
1 month ago
Activity icon

Replied to Polymorphic Trait?

the tip above with $this is correct. but if you need to figure out the class for any reason, you can use the get_class() method https://www.php.net/manual/en/function.get-class.php

Activity icon

Replied to Download To A Specific Location On The Local Computer (not The Server)

as far as i know, this is not possible, you cannot force a download location for downloaded files. it would be very risky (not secure).

Activity icon

Awarded Best Reply on Getting Syntax Error Or Access Violation When Using GroupBy

you can only select the column you group by (item_name in this case) or an aggregate function (min, max, etc) https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

$reserved_items = SoftReserve::select('item_name')
    ->where('pug_id', $pug->id)
    ->orderBy('item_name', 'asc')
    ->groupBy('item_name')
    ->get();

setting strict to false is not a good option, it will chase you down later. just update the code.

Activity icon

Awarded Best Reply on How To Protect Microservices To Get Used Outise Of My App ?

most simple approach is to use a security token, that you can send alongside with the request (either as get parameter or a header), validate it on the service side and serve weather response only if the token is valid.

more complicated approach is an OAuth2 for example, using passport https://laravel.com/docs/7.x/passport

Activity icon

Replied to Problem With Displaying Errors On Login Form Using Sessions

seems fine for me, should work. examine the rendered HTML source code, if the spans with errors aren't hidden by any chance

Activity icon

Replied to Getting Syntax Error Or Access Violation When Using GroupBy

you can only select the column you group by (item_name in this case) or an aggregate function (min, max, etc) https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html

$reserved_items = SoftReserve::select('item_name')
    ->where('pug_id', $pug->id)
    ->orderBy('item_name', 'asc')
    ->groupBy('item_name')
    ->get();

setting strict to false is not a good option, it will chase you down later. just update the code.

Activity icon

Replied to How To Protect Microservices To Get Used Outise Of My App ?

most simple approach is to use a security token, that you can send alongside with the request (either as get parameter or a header), validate it on the service side and serve weather response only if the token is valid.

more complicated approach is an OAuth2 for example, using passport https://laravel.com/docs/7.x/passport

Aug
06
1 month ago
Activity icon

Replied to Foreign Key Tips For Database Design

does all of the comments in a post belong to the same user? so only he/she adds comments to a post? if not, you need a user_id column to know who is the author of the comment

Activity icon

Replied to Markdown Issues With Laravel 7

i would try removing the graham-campbell/markdown completely and start over. remove package, install package, publish all vendor assets. if you use the @markdown directive, there is no need to enable the "view integration" and to use .md* in names, but it doesnt hurt

and since we are talking about laravel 7, you shouldnt need to register the service provider in the config/app.php, automatic package discovery should handle that.

Activity icon

Awarded Best Reply on Laravel Passport Password Grant Question

since you need to post that grant_type & client_id when requesting a token, you should be perfectly fine

Aug
05
1 month ago
Activity icon

Replied to Markdown Issues With Laravel 7

try full class in blade to check if that works:

<h5 class="card-title">
{!! GrahamCampbell\Markdown\Facades\Markdown::convertToHtml($data[0]->description) !!}
</h5>

or use blade directive @markdown

@markdown
# Bar
@endmarkdown
Activity icon

Replied to Laravel On Docker

i did, what makes you think i suggested WSL?

Activity icon

Replied to Laravel Passport Password Grant Question

since you need to post that grant_type & client_id when requesting a token, you should be perfectly fine

Activity icon

Replied to Markdown Issues With Laravel 7

guessing by the method name convertToHtml() i guess you were using https://github.com/GrahamCampbell/Laravel-Markdown ?

this still works in laravel 7 since the 11.2 https://github.com/GrahamCampbell/Laravel-Markdown/releases/tag/v11.2.0 (most recent is 13)

Activity icon

Replied to Laravel Passport Password Grant Question

in the documentation link you posted, the request contains all of these:

        'grant_type' => 'password',
        'client_id' => 'client-id',
        'client_secret' => 'client-secret',
        'username' => '[email protected]',
        'password' => 'my-password',
        'scope' => '',

i think its actually needed, isn't it?

Activity icon

Replied to The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD, PUT, PATCH, DELETE.

does it list the routes correctly when you try php artisan route:list?

do you have the routes cached by any chance? if so, php artisan route:clear, just to be sure.

Activity icon

Replied to Regex

^[boy]+$

https://regex101.com/r/ESfc3Z/1

or if you have the word as one string, use

\b[boy]+\b

https://regex101.com/r/fGN53u/1

Activity icon

Replied to Why Span On Iphone Seperate Arabic Characters ?

and it happens only on iphone? weird.

what's in the $colored_names array? is there any chance, there is "العلي" that gets replaced? what is the html output, this?

م<span class='text-info'>التعلي</span>
Activity icon

Replied to Why Span On Iphone Seperate Arabic Characters ?

show us the surrounding html/blade when you output that and probably a screenshot might help.

seems like something is breaking the text, possibly a css word-break property? or a php wordwrap()?

Aug
02
1 month ago
Activity icon

Replied to Laravel On Docker

do you have the application code in the shared directory between host (windows) and the container? if so, there is terrible I/O performance. terrible. one way (but not the way i like) to make it better, is not to serve the app from the folder directly, but make a cron to r-sync the application files from the shared folder to a local-only folder. it sucks.

have a look at this video, may be you can find something out: https://www.youtube.com/watch?v=dxvSCAgnsKc

Activity icon

Replied to Update Record If Exists Or Create New Record Laravel 7

combination of all the items in $validate needs to be unique in updateOrCreate($validate), is that true?

if not, you might want to separate the attributes into two arrays

updateOrCreate($search_by_these_attribute_for_uniqueness, $append_these_attributes_to_the_first_array_when_creating_new_entry)

read through the docs https://laravel.com/docs/7.x/eloquent#other-creation-methods

Jul
31
1 month ago
Activity icon

Replied to Update Existing Cookies

store the array of products as json in the cookie and when you want to add a new one, push new item to the array and store it back as json

just a concept here:

$cookie_data = json_decode(Cookie::get('products'));
$cookie_data[$pid] = $qty;
Cookie::queue('products', json_encode($cookie_data));
Jul
30
1 month ago
Activity icon

Replied to Windows, VSCode, Blade Highlight Scheme

since i installed rainglow extension (https://rainglow.io/) to vscode , i am very happy with it. i just checked, there are some dark themes you might like. give it a try.

Jul
28
1 month ago
Activity icon

Awarded Best Reply on Interface 'Psr\Http\Client\ClientInterface' Not Found

what does composer install do? or try composer dump-autoload

Activity icon

Replied to Interface 'Psr\Http\Client\ClientInterface' Not Found

what does composer install do? or try composer dump-autoload

Jul
27
1 month ago
Activity icon

Replied to How To Test Get Request Using Postman For Laravel API

127.0.01 shouldn't be a problem, but it is definitely worth checking.

but i wonder where does this: Your HTTP method is not correct come from? where do you have that code? it is not in laravel out of the box... search for this string in your whole project (including the vendor directory) and post here the related code and where it is.

Activity icon

Replied to How To Validate Sql Injection On User Input

sanitize the output when displaying, using the {{ }} statements

Blade {{ }} statements are automatically sent through PHP's htmlspecialchars function to prevent XSS attacks.

Activity icon

Replied to 405 (Method Not Allowed): Vuejs

set the base URL of axios, like this:

axios.defaults.baseURL = 'http://localhost:8000';

here is the documentation

Jul
26
1 month ago
Activity icon

Replied to Rule::unique

and what is the error? does the documentation for the unique rule say something that could be of any help?

Activity icon

Replied to Help With Eloquent

if i get that correctly, you can name it as you like, but if you name the method like that, it is "magically" available as the $supplier->all_diaries object attribute.

have a look at mutators (accessor) documentation

Jul
22
1 month ago
Activity icon

Awarded Best Reply on How To Merge Multiple Rows If They Have Same Id In Yajra Datatables?

what is the datasource ($sales)? eloquent? i think your best shot is to group the data before you feed it to the datatables. so to tweak the datasource (be it Eloquent, Query Builder or a collection) to handle the grouping and calculating the latest date and remaining amount

Jul
20
2 months ago
Activity icon

Replied to Laravel - Dd() Model With All Relationships

does this display what you need?

public function boot()
{
    view()->composer('*', function($view) {
        //dump the results here, to see what is inside
	dump(Category::with('knowledgeRooms')->whereParent_id(0)->get());

        $view->with('menus', Category::with('knowledgeRooms')->whereParent_id(0)->get());
    });
}
Activity icon

Replied to Relationship In Blade

oh, when you have one-to-many relation, do not use the hasOne() definition. use hasMany() and belongsTo() instead. and switch them around, i suppose (as i suggest in the previous post).

and btw, @nakov made a good point with naming the relations as lesson() and subject()

Activity icon

Awarded Best Reply on Relationship In Blade

if you define the relation in Lessons model as this:

return $this->hasOne('App\Subject');

the Lesson becomes a parent, so the foreign key must be in the Subject table. based on your words "...check lessons subject_id column..." you have the subject_id on the lessons table. so either define it the other way around (change hasOne / belongsTo accordingly), or "move" the relationship column to the subjects table

Activity icon

Replied to Relationship In Blade

if you define the relation in Lessons model as this:

return $this->hasOne('App\Subject');

the Lesson becomes a parent, so the foreign key must be in the Subject table. based on your words "...check lessons subject_id column..." you have the subject_id on the lessons table. so either define it the other way around (change hasOne / belongsTo accordingly), or "move" the relationship column to the subjects table

Jul
18
2 months ago
Activity icon

Awarded Best Reply on Passing Parameters From Blade View To Policy

add use App\Process; to your ProcessPolicy.php class