marcosdipaolo

marcosdipaolo

Member Since 5 Months Ago

Experience Points 10,590
Experience
Level
Lessons Completed 100
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

12 Oct
2 months ago
10 Oct
2 months ago

marcosdipaolo started a new conversation Deployment To Production

Hi there. I'm about to deploy to production and I read in Laravel's docs that three lines should be ran. composer install --optimize-autoloader --no-dev php artisan config:cache php artisan route:cache

Since I'd like to keep working further in the app after deployment question is if i can continue working in dev mode in the app once those lines are executed or do i have to rollback the app to some previous state ???

07 Oct
2 months ago

marcosdipaolo left a reply on Edit Laravel 5.7 Verification E-mail?

I already did..........

They talk about the view with the message of "Verify your email", not the email's markdown that is sent to the user to verify the email address

marcosdipaolo started a new conversation Edit Verification E-mail?

Is there a way to customize the verification email beside editing vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php??

03 Oct
2 months ago

marcosdipaolo left a reply on Route Model Binding - Optional RouteKeyName

@Cronix it's what i thought in the beginning, since i needed slugs in my products urls and not ids, but when the time comes where you have to build an e-commerce cart where you'll charge money to people's credit cards, isn't an incremental id less error prone and secure?. I've actually coded some logic to make slugs unique on product's create and update, but still i was unsecure to use slugs for the critical stuff.

06 Sep
3 months ago

marcosdipaolo started a new conversation Embeeding Videos Into Blade Templates.

I'm having some strange (or at the very least unexpected) behavior trying to embeed vimeo and youtube videos in blog posts. I'm using the quill wysiwyg editor, and all that works fine. But once i save a post including an embeeded video within an iframe in it's body..., something like that:

<p>This is a post with an embeeded video.</p>
<iframe class="ql-video" frameborder="0" allowfullscreen="true" src="https://www.youtube.com/embed/w02pBKY-PLM?showinfo=0"></iframe>

The page has a pre-loader and it keeps loading forever, waiting to finish loading the page, which never happens. The snippet above is what is saved to the DB as a string. I'm trying to render it like this:

{!! $post->body !!}

I tried also with {{ }} and many other things, and nothing.

04 Sep
3 months ago

marcosdipaolo left a reply on General Methods And A Method Accepting Instances Of Different Possible Models As Parameter

Oh!!, thanks a lot @Snapey I will surely check out that library!. unfortunately this project is almost finished, I'll stick with the intervention image for this one. Have you tried it? http://image.intervention.io/

And what about 2nd question? can a method receive as a parameter a variable $model_instance which can be an instance of different models depending where nd what you're calling it for?

marcosdipaolo started a new conversation General Methods And A Method Accepting Instances Of Different Possible Models As Parameter

Sorry for the blury title. This is the thing. 1st question: If a build a model that is useful for all controllers, where should I place it?. For ex. the method public function uploadImg(). Many controllers needs to upload an image, so it s a method useful for the whole app, not a certain controller. 2nd question: If that method might be useful for upload images, it would surely need a instance of an object to store at the right row and table the image's url, e.g. Post $post, or User $user. If I'm consistent enough to all model share the same image column name at the table, say "img_url" and "thumb_ur" for thumbnails, is it posible to receive as a parameter a variable that might contain instances of different models? for example this code below (notice I'm using several methods that are not to be found in this snippet, and also the "Intervention Image" library):

public static function uploadImg($model_Instance, Request $request, $width, $prefix) 
    {
        if ($request->hasFile('image')) {
            $model_Instance->deleteImg($hero);
            $ext = $request->image->extension();
            $now = time();
            $photo_path = "/img/{$prefix}/" . "{$prefix}_" . Post::slug($request->title) . "_" . $now . "." .$ext;
            $thumb_path = "/img/{$prefix}/thumbs/" . "{$prefix}thumb_" . Post::slug($request->title) . "_" . $now . "." .$ext;
            $foto = \Image::make($request->image);
            $thumb = \Image::make($request->image)->resize(150, NULL, function($c){
                $c->aspectRatio();
                $c->upSize();
            });
            if ($foto->width() > $width) {
                $foto->resize($width, NULL, function($constraint){
                $constraint->aspectRatio();
                });
            }

            $foto->save(storage_path('app/public') . $photo_path);
            $thumb->save(storage_path('app/public') . $thumb_path);
        }
        else {
                     /* por si no trae foto */
            $photo_path = $photo_path ?? ($model_Instance->img ?? NULL);
            $thumb_path = $thumb_path ?? ($model_Instance->thumb ?? NULL);
        }
        return ['photo_path' => $photo_path , 'thumb_path' => $thumb_path];
    }

This is a desperate try to make this code reusable instead of copying the whole method into two different models

23 Aug
3 months ago

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server.

##Correct!! Thanks a lot @Cronix, that was the error, i wasn't aware that's not allowed and that none of my routes had that slash at the end. Thanks!!!

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server.

Hi @Snapey , thank for your answer . Here my routes file.

Route::get('/' , '[email protected]')->name('inicio');
Route::get('/page/{page}' , '[email protected]')->name('page');
Route::get('/page/delete/{page}', '[email protected]');

Route::get('/blog/publish' , '[email protected]');
Route::post('/blog' , '[email protected]');
Route::get('/post/edit/{post}' , '[email protected]');
Route::post('/post/editPost/' , '[email protected]');
Route::get('/post/delete/{post}' , '[email protected]');
Route::get('/admin/post/delete/{post}' , '[email protected]');
Route::get('/posts/{post}' , '[email protected]')->name('single');
Route::get('/archive/{tag}' , '[email protected]');

Route::get('/admin/{section}' , '[email protected]')->name('adminSection');
Route::get('/admin/pages/{page}' , '[email protected]');
Route::get('/admin/page/create' , '[email protected]');
Route::get('/admin/galeria' , '[email protected]');
Route::post('/admin/galeria' , '[email protected]');
Route::post('/admin/profile/update/' , '[email protected]');
Route::post('/admin/page/create' , '[email protected]');
Route::post('/admin/{page}' ,  '[email protected]');

Route::post('/counter' , '[email protected]');
Route::get('/counter' , '[email protected]');

Route::delete('/gallery/delete' , '[email protected]');
Route::post('/gallery/upload' , '[email protected]');

Route::post('/hero/create', '[email protected]');
Route::get('/admin/hero/delete/{hero}', '[email protected]');


Route::post('/user/add', '[email protected]');
Route::get('/user/edit/{user}', '[email protected]');
Route::post('/user/edit/{user}', '[email protected]');
Route::get('/user/delete/{user}', '[email protected]');
Route::get('/users/{user}', '[email protected]');
Route::get('/register' , '[email protected]');
Route::post('/register' , '[email protected]');

Route::post('/comment/{post}', '[email protected]');
Route::get('/comment/delete/{comment}', '[email protected]');

Route::post('/comment/reply/{comment}', '[email protected]');
Route::get('/reply/delete/{reply}', '[email protected]');

Route::post('/like/create', '[email protected]');
Route::delete('/like/delete', '[email protected]');

Route::post('/suscribe', '[email protected]');
Route::get('/suscriber/delete/{suscriber}', '[email protected]');

Route::post('/events', '[email protected]');
Route::get('/event/delete/{event}', '[email protected]');

Route::post('/products', '[email protected]');
Route::get('/product/delete/{product}', '[email protected]');

/* AUTH */
Auth::routes();


22 Aug
3 months ago

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server.

I created a directory called Laravel at the route of the site (not public_html folder) where i uploaded everything BUT the public folder, which is in the public_html folder. I believe locally i'm working with nginx and remotely with apache. Everything is working pretty nice, only that form is giving problems untill now.

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server.

@Snapey that wasn't for you but for @Cronix.

I'm not sure I understand your question. Everything is set as the local environment. the route at the browser's address bar is mydomain.com/post/editPost.

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server.

Nop, nothing changes, it doesn't even get to the controller, i vave in the controller

   public function update(Request $request)
   {
       return dd($request);
        ...

so i should get the request's dump first thing, but it doesn't get there, i don't know what to try anymore.

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server.

I'll try put, post it works locally anyways.

marcosdipaolo started a new conversation Getting A MethodNotAllowedHttpException When Deployed To Server.

When i hit submit in a form with method POST i get the Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException. No message error. I already checked the route and it doesn't get to the controller. This DOESN'T happen in my local environment.

marcosdipaolo left a reply on Artisan::call Doesn't Work

Let's see if i understand right.

I think i ran that line

php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

when i installed scout and to put scout.php into the config directory, which is a config file. Running that line doesn't create the ScoutServiceProvider in app/providers directory

marcosdipaolo left a reply on Artisan::call Doesn't Work

Can we edit that class in order to make them available from the code?

marcosdipaolo left a reply on Artisan::call Doesn't Work

Hi @Cronix , as always you came to save the day :D Pity, i wanted to run that from a route, the flash and the import, i guess i'll have to export database, and locally import it and run the commands since i have no SSH at the remote server.

marcosdipaolo started a new conversation Artisan::call Doesn't Work

I have in my web route file:

    $exitCode = Artisan::call('scout:import', [
        'model' =>'App\Post'
    ]);
    return redirect('/');
});```
and it doesn't work, my intention is being able to import my records to algolia's search index from a route. 
19 Aug
3 months ago

marcosdipaolo left a reply on Laravel 5.4: Specified Key Was Too Long Error

And if this happens when you're importing the database to the remote server through phpmyadmin?

10 Aug
4 months ago

marcosdipaolo left a reply on Password Resets Without Make:auth

I got it @Cronix, thanks. I could changing $user = $this->create($request->all()); for $user = $this->create($request);

In the [email protected] i went:

protected function create(Request $request)
    {
        if ($request->hasFile('profile_pic')){
        $pathThumb = User::img($request);
        } else { 
            $pathThumb = '/img/users/user.png'; 
        }
        $user = new User;
        $user->name = $request->name;
        $user->full_name = $request->full_name;
        $user->email = $request->email;
        $user->team = $request->team ? 1 : 0;
        $user->role = $request->role ?? NULL;
        $user->bio = $request->bio ?? NULL;
        $user->profile_pic = $pathThumb;
        $user->password = Hash::make($request->password);
        \Mail::to($user)->send(new Bienvenida); 
        $user->save();
        auth()->login($user);
        return $user;        
    }

one small detail is i had my original UserController using a custom FormRequest from Illuminate\Foundation\Http\FormRequest; where i was doing my validation, i tried to do the same in the new [email protected] and it wasn't posible, unlike before, this Request had to be an instance of the Illuminate\Http\Request;, not the App\Http\Requests\UserCreateRequest which was the one i created, but anyways, since the new RegistrationController has that validator i don't really mind

09 Aug
4 months ago

marcosdipaolo left a reply on Password Resets Without Make:auth

I know, the problem is the mass assignments don't update the Algolia's indices. I need other method, see my updated question above.

marcosdipaolo left a reply on Password Resets Without Make:auth

Still here, hope i'm not disturbing.

I have implemented Algolia in this site, and Algolia's indices aren't going to update if i'm creating my users with "Mass assignment" like the default create method does at the RegistrationController.

protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);
    }

I would change it to save() but the create method returns a User object while a save method would return a boolean, besides it receives an array and that won't work with a Request $request, how could i make it a non mass assignment method?

marcosdipaolo left a reply on Password Resets Without Make:auth

yes!! deeply sorry, just found it after posting, i had customized the validator method but not the create. Thanks!

marcosdipaolo left a reply on Password Resets Without Make:auth

thanks, that was of great help. Now, at the register method, i have more inputs than the default ones, and some of them are required at the DB. I'm at the trait RegistersUsers but i don't seem to understand which method to copy and customize to the RegisterController at app/Http/Controllers/Auth

marcosdipaolo left a reply on Password Resets Without Make:auth

I started modifying core controllers like the Illuminate\Foundation\Auth\AuthenticatesUsers, so the debacle begun (haha). Anyways Cronix, you've been most helpful, thanks a lot. I'll keep you posted about the results.

marcosdipaolo left a reply on Password Resets Without Make:auth

ok, the problem is my views, including the login view, register etc need certain variables (e.g. the page you're in ), and i want to check whats going on to modify the controllers but you can't see clearly in the routes because it's all inside the auth:routes and the auth controllers extends stuff, there nothing in them, hard to customize, a least with my level of laravel.

marcosdipaolo left a reply on Password Resets Without Make:auth

Just doing so..., i think i quite dug my own grave when i decided not to go make:auth at the beggining. Isn't better to go ahead and do it now?, and try to fix things once it's done?

marcosdipaolo left a reply on Password Resets Without Make:auth

Thanks a lot, even if that's a superb answer i still have some questions, let start with:

  • how can i manually generate that unique token together with the link in the email blade file?.
  • You say that Laravel uses password_resets table, that table is usually used to store password resets? or all email addresses should go there at the registration as well with that token? -I'd like to use password_resets table as well, can i do that?

marcosdipaolo started a new conversation Password Resets Without Make:auth

From following Jeffrey's 5.4 tutorial i jus made the whole authentication manually, so without going

php artisan make:auth

Now I wonder what is the best way to achieve this once you're in a place where make:auth isn't possible.

05 Jul
5 months ago

marcosdipaolo left a reply on Named Route + Parameter

route('named' , ['placeholder' => 'value'])->with(['var1'=>$value, 'var2'=>$value])

Thank you, you made my day