santino

am independent at home

Member Since 1 Year Ago

Chia

Experience Points
35,140
Total
Experience

4,860 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
284
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.

  • Community Pillar

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

Level 8
35,140 XP
Feb
19
1 week ago
Activity icon

Started a new Conversation Alternative To FORGE

Hi, I was wondering if there is an alternative to deploy my laravel app without forge , BUT fast

I want to deploy an app into my server each time give the instruction to PHP artisan the same way forge does but I want to do it with my own commands, I mean I want to create the command to make the github repository pull content into the server each time I write php artisan app-deploy or something similar

hope this make sense if someone can put me on the right way thanks a lot

here is the commands I want to make the php artisan make for me on the console command after I make the request on the console

after entering the ssh

 cd /var/www/html/site
php artisan down
git pull origin master
composer install 
php artisan migrate
php artisan cache:clear
php artisan queue:restart
php artisan up
Feb
18
1 week ago
Activity icon

Awarded Best Reply on Some Help Here With An Array Conversion Thanks

dont understand how but this helps

 

 public function toSearchableArray()
    {
        $array = $this->toArray();
        return $array;
    }

then index the scout and that convert all to elloquent

Activity icon

Replied to Some Help Here With An Array Conversion Thanks

dont understand how but this helps

 

 public function toSearchableArray()
    {
        $array = $this->toArray();
        return $array;
    }

then index the scout and that convert all to elloquent

Activity icon

Replied to Some Help Here With An Array Conversion Thanks

okay Now I am confused, Some times I search on the bar I got somethimes a SUPPORT collection and other times I got a Eloquent collection, am using the TNT search

Activity icon

Replied to Some Help Here With An Array Conversion Thanks

thanks got more info, I recently found this

convert Illuminate\Support\Collection to Illuminate\Database\Eloquent\Collection

that the think the SEARCH is returning a support collection no an eloquent,... how to transform that support to eloquent? thanks @mabdullahsari

Activity icon

Started a new Conversation Some Help Here With An Array Conversion Thanks

Hi I was using this code that gives me back an array


        $groupContracts = SmartContract::search( strtolower( $this->searchBar ) )
        ->constrain($groupContrains)
        ->get();

$this->smartContracts = $groupContracts->take( $this->loader );

then on the blade I use

@foreach ( (object) $smartContracts as $contract )

///////// this is the collection I got from that code

Illuminate\Support\Collection {#2149 ▼
  #items: array:5 [▼
    0 => App\SmartContract {#2167 ▶}
    1 => App\SmartContract {#2170 ▶}
    2 => App\SmartContract {#2168 ▶}
    3 => App\SmartContract {#2166 ▶}
    4 => App\SmartContract {#2169 ▶}
  ]
}

So it was working... until today, an the error is this one

Call to a member function getFirstMediaUrl() on array SO I NEED TO TRANSFORM THAT ARRAY TO A COLLECTION OR AN OBJECT, but I have no Idea how... ?

Feb
01
3 weeks ago
Activity icon

Replied to Help ReLoading Queue Worker

Thank you very much Mr.Snapey, direct to the answer

Activity icon

Replied to Help ReLoading Queue Worker

@sidneygijzen thanks fo your reply, I am tying to get the most real like if the code is live on the server, that why am with queues and redis,

AM Checking all is woking good before deploy on the server, so how to reload it on the way

thanks a lot

Activity icon

Started a new Conversation Help ReLoading Queue Worker

Hi, I am worrking with ShouldQueue and I am losing a lot of time erloading the worker each time I make a change on the code class that is lunching the queue.

so I got to stop the worker and then re lunch php artisan queue:worker

some tip here to AUTO REFRESH OR AUTOLOAD ON EACH CHANGE.

thanks a lot

Jan
29
4 weeks ago
Activity icon

Started a new Conversation Livewire Upload Image And Use Spatie Media Collections - CORs Errors Too

I have been very busy trying to make the live wire works with the spatie media collections

this is a small guide for someone with the same problem trying to submit

FIRST YOU MUST BE ON THE LOCAL HOST 8000 NOT ON THE NPM WATCH 3000 IT WILL COUSE CORS ERRORS this will throw an error on the view please upload an image

following Porzio code https://laravel-livewire.com/docs/2.x/file-uploads

okay this is my code

// inside the live wire blade component

    <input type="file"
    wire:model="photo">

    @error('photo') <span class="error">{{ $message }}</span> @enderror

on the wire class

<?php

namespace App\Http\Livewire\Profile;

use Livewire\Component;
use Livewire\WithFileUploads;

class EditProfileAvatar extends Component
{
    use WithFileUploads;

    public $photo;

    public function updatedPhoto()
    {
        $this->validate([
            'photo' => 'image', // 1MB Max
        ]);

        //ray( $this->photo );
        user()->addMedia( $this->photo->getRealPath() )
        ->usingName($this->photo->getClientOriginalName())
        ->toMediaCollection('avatar');

    }

    public function render()
    {
        return view('livewire.profile.edit-profile-avatar');
    }


}

the hint here is that you must ->getRealPath of the image where is on the TEMP files or it will not get the image and will not upload, I hope this helps someone with the same code problems

Jan
28
4 weeks ago
Activity icon

Replied to Search Package For My Elloquen Models

This is the way

Jan
27
4 weeks ago
Activity icon

Replied to Print Livewire Collection Inside Alpine Js

@devingray_ got an advance...

$this->nombres = $getSearch->pluck( 'name' );

pluck it then in the alpine

      @if ($infos)
      <template x-for="user in names">
        <li x-text="user" class="userArea"></li>
    </template>
    @endif

this call the users name

you know , I am trying to HIGHLIGHT the text search on the users so If I type MILLER highlight it on the dom so this way the process is made by the client not the server I think is a better aproach ,

Well I cant do the think I want because I dont know to much about programation on alpine .

thanks again

Activity icon

Replied to Print Livewire Collection Inside Alpine Js

thanks, but is not working, the info still empty for some reson

    @foreach ( ( object ) $infos as $user )
    <h2>{{ $user->name }}</h2>
    <div x-text="number">n</div>
    <div x-text="mysearch">n</div>
    <br>
    @endforeach

this works but its on PHP and a foreach of blade sintax so the info is entering the livewire component and enside it its the alpine so the info is there but alpine is not getting it for some how,

BUT the array is showing this output


whit this code I got this 

    @if ($infos) 
    <template x-for="user in $wire.infos"> // inserting the wire info there 
        <li x-text="user"></li>
    </template>
    @endif

• //this is the alpine code FOR so the array got 4 items, but no retrive the info in this case the users
•
•
•

Eric Stokes
1234
miller

Prof. Kraig Miller
1234
miller

Kiana Miller PhD
1234
miller

Brian Miller
1234
miller

Jan
26
1 month ago
Activity icon

Started a new Conversation Print Livewire Collection Inside Alpine Js

Hi , I am woking with livewire and alpine , I am sending a collection of USERS to alpine now I want to print the names

  <div x-data="scope() ">


    @if ($infos)
    <template x-for="user in $wire.infos">
        <li x-text="user.name"></li>
    </template>
    @endif

</div>

<script>

    function scope(){
        return{

        }
    }


</script>

I CANT DO IT, WHATS THE TRICK??

Activity icon

Replied to Search Package For My Elloquen Models

fulltext search and relational search

Jan
25
1 month ago
Activity icon

Started a new Conversation Search Package For My Elloquen Models

Hi, I want to ask the community if know about a better pack than this one to make searches on my search bar

https://github.com/protonemedia/laravel-cross-eloquent-search

this is great I am using it and it is a very good pack but I want to know if there is a faster one.

PLEASE DONT REFERENCE ALGOLIA or a PAYING THIRD-PARTY PACK -- I need to have it on my own server-side no external ones.

thanks in advance

Jan
22
1 month ago
Activity icon

Replied to Migrate A Specific Table

@bugsysha thanks, I want to ask, I got a 10 SCHEMAs inside that class that contains that migrations, the thing is How I can migrate just one schema not all that class file... thanks in advance

Activity icon

Replied to Best Way To Check Is Not Null Or Empty

thanks a lot Michael

Activity icon

Replied to Best Way To Check Is Not Null Or Empty

@chaudigv @michaloravec , thanks both, please is there a way to write something like this

check( $this->userMainAddress->city_id ) {

}

if not, how can I create my own method making that but in all files and folders of LARAVEL , I mean this could be a HELPER? thanks in advance

Activity icon

Started a new Conversation Best Way To Check Is Not Null Or Empty

Hi, want to ask if there is a better way to know if a field is not null or empty

right now I got this

    if ( !empty( $this->userMainAddress->city_id ) ) {}
Activity icon

Started a new Conversation Migrate A Specific Table

hi, I was wondering if there is a way to migrate a specific table that is inside a migration class, here is the example,

  1. inside
class CreateUsersTable extends Migration
{
    public function up()
    {
      Schema::create('users', function (Blueprint $table) {
         $table->bigIncrements('id');
         $table->string('name');
         $table->timestamps();
     });

there is the USER table and creates the user

but after that schema I got this one, and is new never migrated before

    public function up()
    {
      Schema::create('users', function (Blueprint $table) {
         $table->bigIncrements('id');
         $table->string('name');
         $table->timestamps();
     });

      Schema::create('wishContracts', function (Blueprint $table) {
         $table->bigIncrements('id');
         $table->unsignedBigInteger('user_id');
         $table->unsignedBigInteger('smart_contract_id');
         $table->timestamps();
         $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
     });

i want to call something like this command

php artisan migrate --path=create_users_table --schema-path=wishContracts

and migrate just that table inside that class.. that can be done? thanks in advance -- if you know a plugin for this let me know

also, How I dump a specific migration table or full migration class? thanks in advance

Jan
20
1 month ago
Activity icon

Replied to Simplify Route Of GETS In My Routes HELP

Okay mr @devingray_ I will keep working this way, thanks for your time and responses. No one else comments so I feel I am the only one thinking on refactoring it, and if no one else makes a comment is because no one refactors that...

thanks in advance for your help

Activity icon

Replied to Simplify Route Of GETS In My Routes HELP

I see the code with too much repetition that's why I want to shrink it, I mean the ROUTEget and the controller name maybe is a way to hook that with a function??

thank @devingray_ for the help

Activity icon

Replied to @currentURL Question

@snapey please can you specify what is BAD DESIGN, you refer to this code?

        Blade::if('url', function ($value) {
           return Route::currentRouteName() === $value;
     });

if YES please let me know why and how to improve it, please I am learning a lot from the pros

Activity icon

Started a new Conversation Simplify Route Of GETS In My Routes HELP

Hi, I am trying to simplify this

    Route::prefix('{provider:slug}/{order}')->group(function () {
        Route::get('clientChat', '[email protected]')->name('clientChat');
        Route::get('clientSummary', '[email protected]')->name('clientSummary');
        Route::get('clientAgreement', '[email protected]')->name('clientAgreement');
        Route::get('clientDeliveries', '[email protected]')->name('clientDeliveries');
        Route::get('clientInvoice', '[email protected]')->name('clientInvoice');
});

So I want to remove the ROUTE GET and place that on a group and conserve the NAME on each route

I feel that I want to make something like this, HOW?


    Route::prefix('{provider:slug}/{order}')->group(function () {

Route::match(array('GET'),[
    '[email protected]' => 'THE NAME = clientChat',
    '[email protected]' => 'THE NAME = clientSummary',
    '[email protected]' => 'THE NAME = clientAgreement',
    '[email protected]' => 'THE NAME = clientDeliveries',
    '[email protected]' => 'THE NAME = clientInvoice',
]);

I WANT TO SIMPLIFY TO THIS ALSO THE AuthController to not write it each time, PLEASE HELP ME DOING THAT

tHANKS IN ADVANCE...


});
Activity icon

Replied to @currentURL Question

Wonderful, I miss specifying that I was going to match the blade @url with the name of the route end up with this thanks to you

        Blade::if('url', function ($value) {
           return Route::currentRouteName() === $value;
     });

thanks, you make the solution to this question 5 stars for you

Activity icon

Started a new Conversation @currentURL Question

Hi , I want to know if there is a helper that acts like a @IF blade component in this case something like this

@url(home)
@endurl

So I want this to compare the current URL against the url provided in this case home? If there is no helper blade method to do this how I can create one for my app

want to achive this

@if(Request::url() === 'your url here')
    // code
@endif

BUT WITH MY URL new helper

thanks in advance

Jan
15
1 month ago
Activity icon

Replied to Could Not Find Driver Issue

Inside PHPUNIT.XML you will find on the bottom some server options check this and change to mysql

        <server name="DB_CONNECTION" value="mysql"/>

that removes the error for me because I am testing with MYSQL NO WITH SQLITE

hope this helps someone else

Jan
09
1 month ago
Activity icon

Replied to Artisan Event:generate Doesn't Do Anything

thanks Sr.Makes my code run as spected!

Dec
20
2 months ago
Activity icon

Replied to NovaCoreServiceProvider.php Failed To Open Stream: No Such File Or Directory Error

I just discovered that in the vendor file the call was a SHORTCUT so I might thing my machine don't have permission to enter into the shortcuts... the thing is that I copy the content of the shortcut and create a normal folder and paste the info in the VENDOR laravel nova folder ... that makes all running with this NOVA - check if its a SHORTCUT folder that its making the error...

On my case Its with laravel sail , the docker just dont find the shourtcut info of nova... so I make my way

Dec
16
2 months ago
Activity icon

Replied to Route [nova.login] Not Defined.

Thanks, this solve the issue of the route broken

http://localhost:3000/nova/login

now I can enter into NOVA thanks alot

Dec
10
2 months ago
Activity icon

Replied to How To Schedule A Foreach Inside A Email View?

Thank you sir, awesome answer, just what i need!

Activity icon

Replied to How To Schedule A Foreach Inside A Email View?

Hello, so i can do this {{ end }} on the email view and don't use the foreach?

like this:

@component('mail::table')
| Dominio       | Plan         | Vencimiento  | Renovacion  |
| ------------- |:-------------:| --------:| --------:|
| {{ end }}     | ...      |   ...      | ...      |
@endcomponent
Activity icon

Started a new Conversation How To Schedule A Foreach Inside A Email View?

Hello some one can give me a hand with this topic? i got this:

in my Kernel file:

$schedule->call(function () {
            //$plans_n = servHosting::whereMonth('created_at', '=', Carbon::now()->addMonth()->month)->get();
            $plans_n= servHosting::whereMonth('created_at', '=', Carbon::now())->get();
            foreach ($plans_n as $rec) {}

            Mail::to('[email protected]')->send(new HostingReport ($rec));

        })->everyMinute();

in my HostingReport file:


namespace App\Mail;

use App\Models\servHosting;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class HostingReport extends Mailable
{
    use Queueable, SerializesModels;

    public $rec;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(servHosting $rec)
    {
        $this->rec = $rec;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('emails.reports.hosting')
        ->with([
            'plan' => $this->rec->plan,
            'end' => $this->rec->end_date,
            'price' => $this->rec->price,
            'domain' => $this->rec->domain
        ])
        ->subject('Reporte mensual de Hosting - Getweb');
    }
}

in my Hosting email view file:

@component('mail::message')
# Introduction

The body of your message Hosting.

@component('mail::panel')
Resultados proximo mes
@endcomponent

// in this space is going to loop the results
@foreach ($host as $rec)
{{$rec->end}} 
@endforeach

Thanks,<br>
{{ config('app.name') }}
@endcomponent

can anyone help me, please?

Dec
09
2 months ago
Activity icon

Replied to Kernel, Pass Data To Email View

Thank you so much for all your help Michal!! i was struggling a lot of time with this

Activity icon

Replied to Kernel, Pass Data To Email View

thank Michal for your answer but it doesn't work, any other idea?

Activity icon

Started a new Conversation Kernel, Pass Data To Email View

Hello i'm having a lot of problems, this is what i have at the moment, can anyone guide me?

  • in my kernel file i got this:
protected function schedule(Schedule $schedule)
    {
        //$schedule->command('inspire')->everyMinute();

        $schedule->call(function () {
            //send email every month to users
            $plans_user = servHosting::whereMonth('plan', '=', Carbon::now()->addMonth()->month)->get();

            foreach ($plans_user as $recipient) {
                $emails = $recipient->domain;
                Mail::to($emails)->send(new OrderShipped ($plans_user));
            }
            
        })->everyMinute();  
    }
  • in my orderShipped file i got this:
namespace App\Mail;

use App\Models\servHosting;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class OrderShipped extends Mailable
{
    use Queueable, SerializesModels;

    public $plans_user;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(servHosting $plans_user)
    {
        $this->plans_user = $plans_user;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('emails.orders.shipped')
        ->with([
            'domain' => $this->plans_user->domain
        ])
        ->subject('Plan de hosting proximo a vencer');
    }
}
  • in my shipped email message file i got this:
@component('mail::message')
# Plan de Hosting

Contenido del email desde el servidor {{ $plans_user->domain }}

@component('mail::button', ['url' => 'https://getweb.com.co'])
Visita nuestro sitio web
@endcomponent

Gracias equipo,<br>
{{ config('app.name') }}
@endcomponent 

What im doing wrong?

Dec
02
2 months ago
Activity icon

Replied to OnDelete Cascade... Not Working, Some Help?

@sinnbeck @tray2 , thanks for the reply, yes the comment does not get REMOVED still on the MySql database , i know because I remove the ticket and go to the comment table and there still the comments made for that ticket, am using MySql database, thanks for your help

Activity icon

Started a new Conversation OnDelete Cascade... Not Working, Some Help?

Hi, laracasters, I am trying to delete on the cascade. So I Create a ticket with comments if the ticket is removed then remove all the comments with the same ID.. not working, can you please check my code and point me where is the error or issue, thanks a lot

        Schema::create('tickets', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id');
            $table->text('question');
            $table->boolean('closed')->default( false );
            $table->timestamps();
            $table->foreign('id')->references('ticket_id')->on('ticket_comments')
               ->onDelete('cascade');
        });

        Schema::create('ticket_comments', function (Blueprint $table) {
            $table->id();
            $table->integer('ticket_id');
            $table->integer('user_id');
            $table->text('comment');
            $table->integer('like')->default( 0 );
            $table->boolean('best_answear')->default( false );
            $table->timestamps();
            $table->foreign('ticket_id')->references('id')->on('tickets')
	    ->onDelete('cascade');
        });
Nov
17
3 months ago
Activity icon

Replied to Vue Vs Livewire

My personal opinion using Laravel - I like to use livewire with Laravel projects Because the code is almost the same used on Laravel, when I use it I really like that it blends very well with the code, even with the tags done by Taylor like @if(...) that works very well, another thing is that making a test for me is faster than vue because I don't need to compile it so I can see the changes faster on the browser... Another thing I really like is that I don't need to include the tag

	<div id="app">	</div>

just throw the component into Laravel and that's it.

Nov
06
3 months ago
Activity icon

Replied to Need Some Feed Back On How This Works?...

thanks, Sr. @marianomoreyra really appreciate your answer, I need to study this subject more, thanks for the links on the description, getting started on the traits and event system.

Regards Santino

Nov
05
3 months ago
Activity icon

Started a new Conversation Need Some Feed Back On How This Works?...

Hi, I am using spatie slugable on laravel model , It works like a charm... but I really dont understand how it works can some one explain to me how this calls the options , functions , variables ... when I enter to the definition I found the class slugOptions...

Can explain to me how this works??

whats means this = getSlugOptions() : SlugOptions I mean this sign : : : : the doble dots how this works

    public function getSlugOptions() : SlugOptions
    {
        return SlugOptions::create()
        ->generateSlugsFrom([ 'name' , 'sponsor_id' ])
        ->saveSlugsTo('slug');
    }

thanks a lot this is the class of reference

<?php

namespace Spatie\Sluggable;

class SlugOptions
{
    /** @var array|callable */
    public $generateSlugFrom;

    public string $slugField;

    public bool $generateUniqueSlugs = true;

    public int $maximumLength = 250;

    public bool $generateSlugsOnCreate = true;

    public bool $generateSlugsOnUpdate = true;

    public string $slugSeparator = '-';

    public string $slugLanguage = 'en';

    public array $translatableLocales = [];

    public static function create(): self
    {
        return new static();
    }

    public static function createWithLocales(array $locales): self
    {
        $slugOptions = static::create();

        $slugOptions->translatableLocales = $locales;

        return $slugOptions;
    }

    /**
     * @param string|array|callable $fieldName
     *
     * @return \Spatie\Sluggable\SlugOptions
     */
    public function generateSlugsFrom($fieldName): self
    {
        if (is_string($fieldName)) {
            $fieldName = [$fieldName];
        }

        $this->generateSlugFrom = $fieldName;

        return $this;
    }

    public function saveSlugsTo(string $fieldName): self
    {
        $this->slugField = $fieldName;

        return $this;
    }

    public function allowDuplicateSlugs(): self
    {
        $this->generateUniqueSlugs = false;

        return $this;
    }

    public function slugsShouldBeNoLongerThan(int $maximumLength): self
    {
        $this->maximumLength = $maximumLength;

        return $this;
    }

    public function doNotGenerateSlugsOnCreate(): self
    {
        $this->generateSlugsOnCreate = false;

        return $this;
    }

    public function doNotGenerateSlugsOnUpdate(): self
    {
        $this->generateSlugsOnUpdate = false;

        return $this;
    }

    public function usingSeparator(string $separator): self
    {
        $this->slugSeparator = $separator;

        return $this;
    }

    public function usingLanguage(string $language): self
    {
        $this->slugLanguage = $language;

        return $this;
    }
}

Oct
29
3 months ago
Activity icon

Started a new Conversation Best Book/videos Trainning Focus On Laravel Good Pratices And Php

Hi, I am learning laravel and I think that there is a history in order to get into it... so I want to read good books to put me in the best way and get me to focus on been a very good programmer and developer using PHP and Laravel on top...

Can you recommend to me your best book? thanks in advance santino

Oct
28
3 months ago
Activity icon

Replied to Create A HasOne Relations HELP

thanks @michaloravec but how to create the new account with thiss default?

    public function account()
    {
        return $this->hasOne('App\Account')->withDefault();
    }

i not ceating a new one related to the user

I GOT TO DO THIS AND I DONT LIKE IT

			if (!user()->account) {
				user()->account()->create();
			}
Activity icon

Started a new Conversation Create A HasOne Relations HELP

Hi, AM trying to call the user account, but some times get NULL because the user dont have an account created,

user()->account

HOW to call this and if the user dont have an account THEN create one and then call for it...?

thanks in advance

Activity icon

Replied to Help Making A Helper

@rodrigo.pedra , hi rodrigo I jus want to thanks you, and want to let you know how I modify yourr sended code to the final version I need, helps me a lot seeing your code look

Account::getAccount('owners')->transferTo(Account::getAccount('clients'), $product->value );
	public static function getAccount($name)
	{
		return self::query()->firstWhere('name', $name);
	}

	public function transferTo(Account $destinyAccount, $value)
	{
		$this->transactions()->create([
			'debit' => $value,
			'credit' => 0,
		]);
		$destinyAccount->transactions()->create([
			'credit' => $value,
			'debit' => 0,
		]);
	}

I dont have a balance collumn right now, but I will added with the code just gave to me , have an exellent day regards Sant

Activity icon

Replied to Help Making A Helper

thanks, @rodrigo.pedra - It seems that you know a lot about this... really appreciate it, I will read the comment and try to understand each line of code.

Regards Santino

Activity icon

Replied to Help Making A Helper

thanks, it makes the magic @rodrigo.pedra I want to ask, is there a better way to get into this approach, I mean like something more elegant? ... not your code, I mean like make this with service providers or facades or all that stuff, or this is the right and proper way to do this?

Am very new using laravel and I really don't have all the tools on my head

thanks in advance