marcosdipaolo

Experience

8,490

0 Best Reply Awards

  • Member Since 3 Months Ago
  • 79 Lessons Completed
  • 0 Favorites

12th October, 2018

marcosdipaolo left a reply on Algolia: Can Scout Split Records? • 1 week ago

+1

10th October, 2018

marcosdipaolo started a new conversation Deployment To Production • 1 week ago

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 ???

7th October, 2018

marcosdipaolo left a reply on Edit Laravel 5.7 Verification E-mail? • 1 week ago

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? • 1 week ago

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

3rd October, 2018

marcosdipaolo left a reply on Route Model Binding - Optional RouteKeyName • 2 weeks ago

@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.

6th September, 2018

marcosdipaolo started a new conversation Embeeding Videos Into Blade Templates. • 1 month ago

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.

4th September, 2018

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

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 • 1 month ago

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

23rd August, 2018

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server. • 1 month ago

##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. • 1 month ago

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();


22nd August, 2018

marcosdipaolo left a reply on Getting A MethodNotAllowedHttpException When Deployed To Server. • 1 month ago

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. • 1 month ago

@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. • 1 month ago

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. • 1 month ago

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

marcosdipaolo started a new conversation Getting A MethodNotAllowedHttpException When Deployed To Server. • 1 month ago

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 • 1 month ago

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 • 1 month ago

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

marcosdipaolo left a reply on Artisan::call Doesn't Work • 1 month ago

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 • 1 month ago

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. 

19th August, 2018

marcosdipaolo left a reply on Laravel 5.4: Specified Key Was Too Long Error • 2 months ago

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

10th August, 2018

marcosdipaolo left a reply on Password Resets Without Make:auth • 2 months ago

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

9th August, 2018

marcosdipaolo left a reply on Password Resets Without Make:auth • 2 months ago

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 • 2 months ago

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 • 2 months ago

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 • 2 months ago

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 • 2 months ago

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 • 2 months ago

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 • 2 months ago

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 • 2 months ago

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 • 2 months ago

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.

5th July, 2018

marcosdipaolo left a reply on Named Route + Parameter • 3 months ago

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

Thank you, you made my day

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.