nam_co

nam_co

Member Since 5 Years Ago

Experience Points 12,260
Experience Level 3

2,740 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 112
Lessons
Completed
Best Reply Awards 0
Best Reply
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.

11 Jan
3 months ago

nam_co left a reply on Path To Mailables Inside A Package

Thanks D, I got it working by changing the namespace in the mailable file :)

nam_co left a reply on Path To Mailables Inside A Package

Hi, thanks for the response, here it is

    "autoload": {
        "psr-4": {
            "Maksuco\Subscription\": "src"
        },
        "classmap": [
            "src/database/migrations"
        ]
    },

nam_co started a new conversation Path To Mailables Inside A Package

Hi, thanks in advance, Im trying to develop a local package, but Im not able to use the mailable file inside the package

Controller:

<?php
namespace Company\Subscription\Http\Controllers\Subscription;

use Mail\PlanSuspend; (this path is vendor\company\subsccription\src\mail\PlanSuspend)

Can somebody please help me, what is the correct path? I prefer not to publish the mailables to keep it clean

07 Nov
5 months ago

nam_co started a new conversation Avoid Landing Page Redirects In Forge

Hi, Im getting a recommendation to Avoid landing page redirects, right now my domain should be https://www.mydomain.com but when I type my domain.com in gmatrix Im getting this recommendation

Avoid landing page redirects for the following chain of redirected URLs.

http://mydomain.com/ https://mydomain.com/ https://www.mydomain.com/

is it possible to avoid the second redirect and go straight to https://www this is what forge automatically puts in:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.tusmenus.com;
    root /home/forge/www.tusmenus.com/public;

Appreciate any help, thanks

14 Oct
6 months ago

nam_co left a reply on RedirectIfAuthenticated Not Working

yes, but controller is just:

    public function login()
    {
        if(isset($_GET['redirect'])) {
            session()->put('redirect', $_GET['redirect']);
        }
        return view('auth.login');
    }

nam_co left a reply on RedirectIfAuthenticated Not Working

I got in the routes (web.php) file:

Route::get('ingresa', '[email protected]');
Route::group(['middleware' => 'lang:en'], function () {
    Route::get('login', '[email protected]');
});

nam_co left a reply on RedirectIfAuthenticated Not Working

ok, if someone is authenticated and goes to /login or /register, it should automatically send them to user/favorites

nam_co left a reply on RedirectIfAuthenticated Not Working

Hi Snapey, thanks for the response, what do you mean by "right concept"? the rest of the RedirectIfAuthenticated is exactly the same as it comes from Laravel

nam_co started a new conversation RedirectIfAuthenticated Not Working

HI, hope somebody can help me, when Im login and visit Im not being auto redirected to the specified page, hope somebody can help me

public function handle($request, Closure $next, $guard = null)
    {
        if (Auth::guard($guard)->check() AND session()->has('redirect')) {
            $redirect = session()->get('redirect');
            session()->forget('redirect');
            return redirect($redirect);
        }
        if (Auth::guard($guard)->check()) {
            return redirect('/user/favorites');
        }

        return $next($request);
    }

Appreciate the help

nam_co left a reply on Route::redirect With Variables

Hi Cronix, sorry for the late response, I don't use apache .htaccess, but forge's nginx, but your answer is correct , it simple can't be done in the routes file, thanks

11 Oct
6 months ago

nam_co left a reply on Route::redirect With Variables

Hi Cronix, thanks for the response, the idea is to used with out any controller intervention

nam_co started a new conversation Route::redirect With Variables

H, hope somebody can help me, I was wondering how do we pass variables in a Route::redirect('food/{cat_slug}', 'something-{cat_slug}', 301);

Thanks

nam_co left a reply on 5.5 Route::view With Language Data

Hi Sutherland, hope everything is ok, I was wondering if you knew how do we pass variables in a Route::redirect('{city_slug}/food/{cat_slug}', '/{city_slug}/food-{cat_slug}', 301);

thanks

31 Jul
8 months ago

nam_co left a reply on Getting The $to Data Inside The Mailable

Hi @thomaskim , one question, How can I access this ($to) in the actual email design (blade file)?

Appreciate your help

15 Apr
1 year ago

nam_co left a reply on Pass Variable From Layout (@extend) To View (@yield)

Hi KNietzsche and Jaspy, thanks for the answer, the idea is to do it with out any controller intervention, something like @yield('content', [$hope,$somethingelse]

nam_co started a new conversation Pass Variable From Layout (@extend) To View (@yield)

Hi, I was wondering if someone has any suggestions on how to pass a variable from the layout blade template to the view file (with out any controller intervention)

In the layout template:

@yield('content')

In the blade view: @extends('default') @section('content') {{$hope}} @stop

Thanks in advance for any help

16 Mar
1 year ago

nam_co left a reply on Htaccess To Nginx

Hi cronix, thanks for the answer, it’s regular php (no framework)

I tried converters but they don’t work very well

Thanks

nam_co started a new conversation Htaccess To Nginx

Hi, hope somebody can help me, in transforming my apache htaccess rules to nginx config

  1. removing the .php from the url's, so url: "/contac"t displays the file contact.php

  2. make this paths use their respective php file "/products" shows the file products-all.php "/products/some-category-name" shows the file products-cat.php "/products/some-category-name/product-name?id=89" shows the file products-detail.php

I tried searching everywhere, but couldn't fine the correct answer, appreciate any help

Thanks

02 Mar
1 year ago

nam_co left a reply on Custom Blade Provider Variable Condition

Thanks Bobby, it seems easier to just do @if(isset(

27 Feb
1 year ago

nam_co started a new conversation Custom Blade Provider Variable Condition

Hi, hope somebody can help me, Im looking for a way to check if a variable exist in the blade and if the user login, currently I have this but it doesn't work

        \Blade::if('account', function () {
            return auth()->check() && isset($account) == TRUE;
        });

I know I can do @account($account) but the idea is that $account is not always available, how can I use this?

Hope somebody can help me, thanks

04 Jan
1 year ago
11 Oct
1 year ago

nam_co left a reply on Package Development

Hi Pawel thanks for the answer, is there a way to fire php artisan make:listener just when composer install or composer update?

nam_co left a reply on Change Key For Crypt

I need up using a package

nam_co left a reply on Start And Stop Queue

Hi, what I did was a foreach "php artisan queue:work --once", thanks

nam_co started a new conversation Package Development

Hi, I was wondering if it's possible for a package to register a event in EventServiceProvider.php and create a file in app\listeners?

Thanks

26 Sep
1 year ago

nam_co started a new conversation Render Some Blade/variables With A Function

Hi, hope can help me, Im trying to render some blade with a function, but I can't seem to get it working

$attributes = array_merge(["class" => "form-control"], $attributes);
$string ='<div class="form-group form-group-default"><label for="{{$name}}">{{$label}}</label><input type="text" name="{{$name}}" id="{{$name}}" value="{{$value}}" {{$attributes}}></div>';
return \Blade::compileString($string, ['name' => 'hello_field','label' => 'Hello','value' => $value,'attributes' => $attributes]);

but this returns:

<div class="form-group form-group-default"><label for="<?php echo e($name); ?>"><!--?php echo e($label); ?--></label><input type="text" name="<?php echo e($name); ?>" id="<?php echo e($name); ?>" value="<?php echo e($value); ?>" <?php="" echo="" e($attributes);="" ?="">&gt;</div>

Appreciate any help

21 Sep
1 year ago

nam_co left a reply on Start And Stop Queue

Hi Sutherland, the strange thing, is that in my local/mamp it works perfect, but in my linode 1GB ram after a while it shows the 502 and got this: Out of memory: Kill process 22057 (mysqld) score 33 or sacrifice child^M Killed process 22057 (mysqld) total-vm:137340kB, anon-rss:76576kB, file-rss:8kB, shmem-rss:0kB^M Out of memory: Kill process 22149 (mysqld) score 32 or sacrifice child^M Killed process 22149 (mysqld) total-vm:137340kB, anon-rss:74960kB, file-rss:4kB, shmem-rss:0kB^M

this is the payload in the DB

{"displayName":"App\\Mail\\SendInvoice","job":"Illuminate\\Queue\\[email protected]","maxTries":null,"timeout":null,"data":{"commandName":"Illuminate\\Mail\\SendQueuedMailable","command":"O:34:\"Illuminate\\Mail\\SendQueuedMailable\":3:{s:8:\"mailable\";O:20:\"App\\Mail\\SendInvoice\":24:{s:3:\"biz\";O:45:\"Illuminate\\Contracts\\Database\\ModelIdentifier\":2:{s:5:\"class\";s:7:\"App\\Biz\";s:2:\"id\";i:2;}s:7:\"invoice\";O:45:\"Illuminate\\Contracts\\Database\\ModelIdentifier\":2:{s:5:\"class\";s:12:\"App\\Invoices\";s:2:\"id\";i:88;}s:6:\"client\";O:45:\"Illuminate\\Contracts\\Database\\ModelIdentifier\":2:{s:5:\"class\";s:11:\"App\\Clients\";s:2:\"id\";i:102;}s:8:\"payments\";N;s:3:\"pdf\";N;s:13:\"email_content\";s:109:\"La Cuenta de cobro CC-422 por un total de $888 esta lista, y puedes descargarla desde este correo.\r\n\r\nGracias\";s:9:\"unique_id\";N;s:7:\"subject\";s:23:\"Cuenta de cobro #CC-422\";s:7:\"branded\";b:1;s:4:\"from\";a:0:{}s:2:\"to\";a:1:{i:0;a:2:{s:4:\"name\";N;s:7:\"address\";s:14:\"[email protected]\";}}s:2:\"cc\";a:0:{}s:3:\"bcc\";a:0:{}s:7:\"replyTo\";a:0:{}s:11:\"\u0000*\u0000markdown\";N;s:4:\"view\";N;s:8:\"textView\";N;s:8:\"viewData\";a:0:{}s:11:\"attachments\";a:0:{}s:14:\"rawAttachments\";a:0:{}s:9:\"callbacks\";a:0:{}s:10:\"connection\";N;s:5:\"queue\";N;s:5:\"delay\";N;}s:5:\"tries\";N;s:7:\"timeout\";N;}"}}

Since I don't need it to continue listening to new jobs, Im trying to find a way to stop it automatically

nam_co started a new conversation Start And Stop Queue

Hi, hope somebody can help me, I have a Scheduled Job that puts in the DB a series of jobs/rows each morning, I use "php artisan queue:work" and it sends the emails, but it continues to run and after a while I get a 502 on the nginx server (supposed to run out of memory), since theres not going to be any more new jobs available on that day, is there a way to just run the available jobs in the DB and then stop.

"php artisan queue:work --once" only runs the first one and stops, I wonder if there something like this but that runs all jobs in the DB

Thanks

nam_co left a reply on 5.5 Route::view With Language Data

Hi sutherland, yes, it seems that middleware is the simplest way to go

30 Aug
1 year ago

nam_co started a new conversation 5.5 Route::view With Language Data

Hi, I was wondering if its possible to set/include the app lang (App::setLocale('en')) using the new Route::view('/', 'front.index', ['lang' => 'en']); I know its possible using code in the view, but is it possible to set it directly in the route file?

Thanks for any help

16 Aug
1 year ago

nam_co left a reply on Paypal Ipn Pakage For Laravel

Hi mike, have you ever tried this https://github.com/sh0umik/Laravel5-PaypalIPN and what is your recommendation for single payments today? 2017

thanks

06 Aug
1 year ago

nam_co left a reply on Mailable Problem In Loop

@nash it work, thanks, but why?

nam_co left a reply on Mailable Problem In Loop

I put in the foreach $i = $i + 1; echo $row." "; if($i == 2) { dd($row); } and it worked fine showing this [email protected] [email protected] sendemail.com (you can see the row shows each email apart) "[email protected] sendemail.com" (the last email dd is alone)

@nash let me try that

nam_co left a reply on Mailable Problem In Loop

Hi @Nash , yes dd($row); in the foreach only returns one address (the first one), I think the problem will start with the second loop, I will try a if..second loop to see what the dd returns

nam_co left a reply on Mailable Problem In Loop

Hi @edoc , I tried Mail::to(request()->emails) but it doesn’t work

nam_co started a new conversation Mailable Problem In Loop

Hello, hope somebody can help me, Im trying to send multiple emails from the controller

''' foreach(request()->emails as $row){ if($row){ Mail::to($row)->send($message); } } '''

doing dd(request()->emails); before shows me: ''' array:2 [▼ 0 => "[email protected]" 1 => "[email protected]" ] '''

but this sends 2 emails:

  1. [email protected]
  2. [email protected] thefirstemail.com,[email protected] ( see how the second email includes both address, this also happens when its tree emails etc..

Appreciate any ideas

02 Aug
1 year ago

nam_co left a reply on Getting The $to Data Inside The Mailable

Hi Thomas thanks for the response, I put on the top public $to; and tried to call it from the _construct() with $this->to but it saves as null, any ideas?

Thanks

01 Aug
1 year ago

nam_co started a new conversation Getting The $to Data Inside The Mailable

Hi, hope somebody can help me, is there a way to get the $to email address from inside the Mailable file with out passing it from the controller?

Something like: public function __construct() { $this->email = $to;

in case this is not possible, is there a way to append additional data to a Mailable, example:

$message = (new SendEmail($biz))->onConnection('sync'); Then: Mail::to($row)->queue($message, ['email' => $row]); //adding the email to the data

Appreciate any help

24 Jul
1 year ago

nam_co left a reply on Iframe And X-Frame-Options

Hi devwootbit, This is what I got:

#add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
12 Jun
1 year ago

nam_co left a reply on Laravel-snappy On Local Mac?

Hi, did you ever manage to fix snappy?

01 Jun
1 year ago

nam_co left a reply on Trying To Put A Key/value In A Collection

No. 3 works :), but no.1 shows this error Undefined variable: cities, any ideas?

nam_co left a reply on Trying To Put A Key/value In A Collection

Thanks Bunny, it only took $project['city'] for $project-> city, thanks, witch do you recommend option 1 or 3? witch is faster

nam_co left a reply on Trying To Put A Key/value In A Collection

Hi Martin, because DB is faster I guess, but if you make the suggestion I already have both Models created.

The problem is, that projects returns: {id:x,name:'Something',city:45646} I need to change this city id number for the city name witch is in an external db, so the result would be: {id:x,name:'Something',city:'la la land'}

nam_co started a new conversation Trying To Put A Key/value In A Collection

Hi, hope somebody can help me, Im trying to put a key (city name) inside the projects results, I tried join, but since cities is in a external DB I couldn't , I tried collection push and map, but Im just not that good

        $projects = DB::table('projects')->get();
        $cities = DB::connection('mysql2')->table('cities')->select('geoid','name')->get();
        
        foreach($projects as $project) {
            $name = $cities->where('geoid', $project->city_id)->pluck('name')->first();
            $project['city'] = $name;
        }

Appreciate any help Regards

09 May
1 year ago

nam_co left a reply on Where Inside Blade L5.4

thanks Engel, this is true, but I wist there was a way to use $users->whereMonth.. it just seem a lot simpler than using filter

nam_co left a reply on Where Inside Blade L5.4

Hi to everyone, I decided to move everything to the controller, but Im getting ceros, can some body please help me

$users = DB::table('users'); $total1 = DB::table('users')->count(); //this works but requites another DB call $total2 = $users->count(); //how can I make this work? it only returns 0

Appreciate the help

08 May
1 year ago

nam_co left a reply on Where Inside Blade L5.4

Hi snapey, would it help if I pass $users from the controller as a collection? And do the rest inside blade

True about the year, I guess I can work that out with another filter

nam_co left a reply on Where Inside Blade L5.4

basically this is my users model: class User extends Authenticatable { use Notifiable;

protected $fillable = [
    'name', 'email', 'password',
];

protected $hidden = [
    'password', 'remember_token',
];

}