s4muel

s4muel

Member Since 2 Years Ago

Experience Points 68,930
Experience Level 14

1,070 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 424
Lessons
Completed
Best Reply Awards 45
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.

22 Mar
3 months ago

s4muel left a reply on How To Validate Two User Record In One Table

use Illuminate\Validation\Rule;
...
Validator::make($data, [
    'product_name.*' => [
        'required',
        Rule::unique('products', 'product_name'))->where(function ($query) {
            return $query->where('user_id', auth()->user()->id); //or any other condition you need
    ],
    ...
]);
20 Mar
3 months ago

s4muel left a reply on Is Laravel Moving Towards Deprecating Helpers?

i dont think, that many of the core helpers will be removedl, these were a specialty (and i agree a useless ones)

link to the PR with a comment to remove them: https://github.com/laravel/framework/pull/26898 Taylor's comment on the topic: https://github.com/laravel/framework/pull/25421#issuecomment-448237312

15 Mar
4 months ago

s4muel left a reply on Email Verification Button

$url = URL::temporarySignedRoute('verification.verify',Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),['id' => $user->id]);

source: https://github.com/laravel/framework/blob/5.8/src/Illuminate/Auth/Notifications/VerifyEmail.php#L60

14 Mar
4 months ago

s4muel left a reply on Do I Need A Rollback If I Catch Sever Error?

@APOKALL - but when the transaction is not properly closed, any possible other db calls that should be outside of the transaction, don't get executed. that's what i meant.

12 Mar
4 months ago

s4muel left a reply on Do I Need A Rollback If I Catch Sever Error?

i would call the rollback. not an expert here, but this is what i think: if the server error does not stop the script execution, other/latter db calls might get "end up" in the uncommited transaction. plus is surely does some housekeeping.

10 Mar
4 months ago

s4muel left a reply on Postgresql Connection Over SSL Certificates

in your config/database.php file, edit the postgres config

'pgsql' => [
    ...
    'sslmode' => 'verify-ca',
    'options' => [
        // put here additional ssl options, like certs, etc.
    ],
    ...

have a read trhough pgsql docs for the options: https://www.postgresql.org/docs/9.6/libpq-ssl.html

05 Mar
4 months ago

s4muel left a reply on How To Add 4 Weeks In Start_date And Store In End_date In Database

use Carbon\Carbon;
...
$date = new Carbon($request->start_date);

// or if you need to specify a format
//$date = Carbon::createFromFormat('Y-m-d', $request->start_date);

//and then:
$game->end_date = $date->addWeeks(4)->format('Y-m-d');

s4muel left a reply on Does Mailgun Driver Handle Rate Limiting?

i dont think it is handled at all

03 Mar
4 months ago

s4muel left a reply on How To Make 2 Routes With Same Name

AFAIK the URI needs to be unique when defining routes (else it will be overwritten)

24 Feb
4 months ago
22 Feb
4 months ago

s4muel left a reply on How Registration Table Name Print

$student->registration->student_name

s4muel left a reply on Problem In Searching Using Book's Author - Eloquent Relationships

App\Book::whereHas('authors', function ($query) {
    $query->where('authors.name', 'like', "%geo%");
})->get();
21 Feb
4 months ago

s4muel left a reply on Cant See Storage Files In Browser

if you start the app with php artisan serve it uses an 'internal' server and doesnt use XAMPP. the app then runs at http://127.0.0.1:8000 (or similar) and the hostname is not used and not known at all

s4muel left a reply on Cant See Storage Files In Browser

@SKYCODER - whats the line for projects.test in hosts file?

s4muel left a reply on Cant See Storage Files In Browser

what php+web server setup do you have? docker or a kind of WAMP? make sure you have projects.test hostname + ip set in C:\Windows\System32\drivers\etc\hosts file

20 Feb
4 months ago

s4muel left a reply on Issue Editing Remote Files With Winscp

being in sudo group and running the command using sudo is a different thing

s4muel left a reply on Why Is First Column In Table Wider Than Others Column?

and first make sure your html is valid, couple of hints: class="rTableHead"style=" <<= you miss a space before style attribute </br> is just an invalid closing tag, use <br /> instead make id attributes unique id ="printPageButton" is there several times there is no closing tag for <div class="rTable" > as far as i noticed correctly

19 Feb
5 months ago

s4muel left a reply on Bigint Column Is Treated As Int Only On One Table

try either:

class VentaTemporalPlazo extends Model
{
    ...
    public $incrementing = false;
    ...
}

or

class VentaTemporalPlazo extends Model
{
    ...
    protected $casts = [
            'id' => 'string',
    ];
    ...
}
18 Feb
5 months ago

s4muel left a reply on What Is The Difference Between API Resource And Eloquent Collections

API Resource is a transformation layer. if you don't want to output eloquent models 1:1.

17 Feb
5 months ago

s4muel left a reply on Laravel Pagination Links Reset The GET Query

    ...
    ->paginate(6)
    ->appends(request()->query());
14 Feb
5 months ago

s4muel left a reply on String With A "b" Prefix On Records With Accent

@SPACEDOG4 - hm, try to utf8_encode() it, for example in the accessor as i mentioned before

public function getNomeprodutoAttribute($value) {
    return utf8_encode($value);
}

or elsewhere, before encoding it to the JSON.

é (\xE9)is invalid, but `é (\u00e9is valid.

13 Feb
5 months ago

s4muel left a reply on String With A "b" Prefix On Records With Accent

@SPACEDOG4 - oh, i see now, as found in https://symfony.com/doc/current/components/var_dumper.html documentation there is an example: https://symfony.com/doc/current/_images/02-multi-line-str.png

so because of the éthe string is not a valid UTF8 (that's what the ` in dumper means)

s4muel left a reply on String With A "b" Prefix On Records With Accent

the b means it is a binary string (search for binary here: http://php.net/manual/en/language.types.type-juggling.php)

dig deeper to get to the cause, but in the meantime you have to cast it to a string, using a unpack() http://php.net/manual/en/function.unpack.php

the easiest way would be creating an accessor on Produto class

public function getNomeprodutoAttribute($value) {
//return some relevant unpack here, e.g: unpack('C', $value);
}

s4muel left a reply on Call To Undefined Method Barryvdh\Debugbar\Facade::isDeferred()

have a look in your config/app.php make sure it looks like this

'providers' => [
...
//this should be here
Barryvdh\Debugbar\ServiceProvider::class,

//this below (or any similar) shouldn't be here
//'Debugbar' => Barryvdh\Debugbar\Facade::class,
...
];

11 Feb
5 months ago
09 Feb
5 months ago

s4muel left a reply on Deployment 500 Error: Debian9, Apache2

run

php artisan key:generate

to generate the application key

s4muel left a reply on WhereHas() Relation

@JAHELLER - something like this

$products = Product::withCount('views')->orderBy('views_count', 'desc');

s4muel left a reply on WhereHas() Relation

what do you want to do, just get a count of views of products? if so, have a look at "Counting Related Models" in the following section of the docs: https://laravel.com/docs/5.7/eloquent-relationships#querying-relations there is a withCount method

s4muel left a reply on Mail Delivery Configuration.

show us the code that you used to send an email

05 Feb
5 months ago

s4muel left a reply on Carbon\Carbon Vs Illuminate\Support\Carbon?

Here is the difference between a/b https://laravel.com/api/5.5/Illuminate/Support/Carbon.html

I personally vote for a.

And if the package is removed from laravel, it would definitely be a breaking change, so I don't think it will be ( at least any time soon)

01 Feb
5 months ago

s4muel left a reply on Route With Id Showing 404

you have a typo in $oderid

s4muel left a reply on Mail::send Works But ::queue Doesn't

have a look here https://github.com/laravel/lumen-framework/issues/590, might help to call $app->make('queue'); before the queue service is first used... read through the comments

s4muel left a reply on Why Doubled Name In Route Name ?

try to remove the 'as' => 'departments' in here:

Route::resource('departments', 'Admin\DepartmentsController', [ 'as' => 'departments', 'except' => [] ] )->middleware('WorkTextString');
31 Jan
5 months ago

s4muel left a reply on Correct HTTP Status Codes For API When Exception Is Thrown

depends, if the reason, why the db storing failed is because a duplicate value, 409 Conflict is perfectly fine. otherwise i would suggest 422 Unprocessable Entity.

29 Jan
5 months ago

s4muel left a reply on Why Get 'openssl_encrypt() Expects Parameter 1 To Be String, Array Given Exception' ?

try to clear cache: php artisan cache:clear and delete browser cookies

s4muel left a reply on Sending Email Notification To Users

$users should contain Model entities, that uses Notifiable trait.

s4muel left a reply on How To Compare Two Dates Without Year

you have created_at column with values like "12.12"? for sure? if it really is like 12.12. use d.m. format: `where('created_at', Carbon::today()->format('d.m.'));1

28 Jan
5 months ago

s4muel left a reply on SQLite Foreign Keys With Set Null On Delete Not Working For PHPUnit Test

@GEWODE - you have to enable the foreign keys for the sqlite connection. i suggest using something like:

if (DB::connection() instanceof \Illuminate\Database\SQLiteConnection) {
    DB::statement(DB::raw('PRAGMA foreign_keys=on'));
}

in your tests common class (e.g. TestCase setUp() method or similar)

or updage your laravel to >= 5.7.13 that has a simple option in config, which seems to be enabled by default https://github.com/laravel/laravel/blob/v5.7.19/config/database.php#L40

27 Jan
5 months ago

s4muel left a reply on Call To A Member Function Paginate() On String

do not do it like this:

$query .= "->where('city' ,'like', '%' . $city . '%')";

just call that fluently. initialize the $data in the beginning and then just in the if/else statement call

return $data->where('city' ,'like', '%' . $city . '%')";

s4muel left a reply on SQLite Foreign Keys With Set Null On Delete Not Working For PHPUnit Test

How exactly did you enable the foreign key constraints?

s4muel left a reply on How To Delete Subcategories When I Delete Parent Category Without Foriegn Keys

override the delete() method in your Category model class

public function delete() {
    $this->subcategories()->delete();
    return parent::delete();
}
25 Jan
5 months ago

s4muel left a reply on Laravel Image HashName()

it is possible, but the probability is very low. if you want to be more sure, i suggest using Str::orderedUuid() https://laravel.com/docs/5.7/helpers#method-str-ordered-uuid

s4muel left a reply on Retrieve All Items Using Pagination

not sure, but try ->paginate(0)