Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

artmonger

Hire Me

Experience

12,655

0 Best Reply Awards

  • Member Since 2 Years Ago
  • 248 Lessons Completed
  • 0 Favorites

9th October, 2017

artmonger left a reply on Mysterious String Phenomena • 2 months ago

I came up with another solution: <ul> @foreach($chickens as $chicken) <li> @if($chicken->is_bantam == true) <label>bantam</label> @endif {{ $chicken->variety }} {{ $chicken->name }} <a href="{{ route('/chickens/{kind}/create', ['kind' => $chicken->variety."-" .$chicken->name]) }}">create</a> </li> @endforeach </ul> I changed the two slugs to just one and added a "-" in the array passed as the second argument to the route() method.

I updated my Route to this, Route::get('/chickens/{kind}/create', [ 'as' => '/chickens/{kind}/create', 'uses' => '[email protected]' ]);

and my Controller method, public function create($kind) { $kind; return view('chickens.create', compact('kind')); }

However, this doesn't allow me split the breed $variety and $name variables up, and I didn't figure out the missing character part.

Here's what I used to have...

Old Index: <ul> @foreach($chickens as $chicken) <li> @if($chicken->is_bantam == true) <label>bantam</label> @endif {{ $chicken->variety }} {{ $chicken->name }} <a href="{{ route('/chickens/{variety}{name}/create', ['variety' => $chicken->variety, 'name' => $chicken->name]) }}">create</a> </li> @endforeach </ul>

Old Controller: public function create($variety, $name) { $variety; $name; //dd($name); return view('chickens.create', compact('variety','name')); } Old Route: Route::get('/chickens/{variety}{name}/create', [ 'as' => '/chickens/{variety}{name}/create', 'uses' => '[email protected]' ]);

and whether id die&dumped the variables passed to the Controller, or passed them through to the compact() method, I would get broken strings.

For example, a Golden Wyandotte, would end up as a "Golden e".

Or if I tried doing this, in the controller $breed = $variety. ' '.$name; I would end up with "Golden Wyandot te". with a space inbetween the t's.

Also, when I would insert "-", instead of a space, such as $variety.'-'.$name, I could get "Golden Wyandot-te".

LOL. So, mysterious!

artmonger left a reply on Mysterious String Phenomena • 2 months ago

The route() method requires named routing. when I use named routing, I get my page dumping all my chickens. But when I select the create link I only get the last letter of the breed name. That's just strange.

artmonger left a reply on Mysterious String Phenomena • 2 months ago

I tried this:

Route::get('/chickens/{variety}/{name}/create', '[email protected]');

and I changed my route method to,

create

but I'm getting an error Exception,

Route[/chickens/{variety}/{name}/create] not defined... How is that possible? The strings, match.

artmonger started a new conversation Mysterious String Phenomena • 2 months ago

I'm passing two variables from the index page to the create page. The output inserts white-space into the characters of the variable if I concatenate the two variables in the controller. Other times, it only gives me the last character, or the first characters and cuts off the last one.

Here's the part on my index page:

  • {{ $chicken->variety }} {{ $chicken->name }} create
  • Here's the Route: Route::get('/chickens/{variety}{name}/create', [ 'as' => '/chickens/{variety}{name}/create', 'uses' => '[email protected]' ]);

    With just one variable, it was working great. I could pass a breed name and I'd get it on the create page, such as "Create a new Sebright", etc.

    However, I want to pass in a variety slug, such as "Create a new Golden Sebright" or "Create a new "Silver Sebright", etc.

    Here's my controller method: public function create($variety, $name) { $variety; $name;

        return view('chickens.create', compact('variety', 'name');
    }
    

    What do I get? Very strange things, like... "Create a New l" That's the last character in Aseel.

    or if I click on an Ameraucana, I end up with "Create a New a" Again, the last letter.

    I tried this, $breed = $variety. ' ' .$name; and then passing $breed to compact()...

    But I get thinks like "American Buf f". Note, the space between the f's.

    dd($breed); and I get two strings... One is the first word, the second is the last character of the breed name.

    I've tried using with(); but I still find problems.

    What do you think?

    3rd September, 2015

    artmonger left a reply on Use Existing Database To Generate Migrations • 2 years ago

    Yeah, that turned out to be the solution. I made a few mistakes and was getting some exceptions thrown at me. I did a clean install on a project and then followed the directions carefully and it worked awesome! So happy this exists. Thanks.

    2nd September, 2015

    artmonger started a new conversation Use Existing Database To Generate Migrations • 2 years ago

    Does anyone have a recommendation for a migration generator for Laravel 5.0+?

    I want to create migrations and seeders from an existing database.

    18th May, 2015

    artmonger left a reply on How To Create A Separate Admin Panel? • 2 years ago

    @goeroe Yes, that's correct. @bashy needed the arrow between 'prefix' and 'admin', instead of a comma.

    1st May, 2015

    artmonger started a new conversation SendGrid Authentication Quirk With Laravel Environmental File • 2 years ago

    According to SendGrid's docs for Laravel Integration, they recommend the following settings:

    return array( 'driver' => 'smtp', 'host' => 'smtp.sendgrid.net', 'port' => 587, 'from' => array('address' => 'from@example.com', 'name' => 'John Smith'), 'encryption' => 'tls', 'username' => 'sendgrid_username', 'password' => 'sendgrid_password', );

    ?>

    Here's the code snippet they provide for testing email:

    Mail::send('emails.demo', $data, function($message) { $message->to('jane@example.com', 'Jane Doe')->subject('This is a demo!'); });

    ?>

    I was receiving 500 Status errors. However I could connect using telnet and was authenticated. It turned out my emails were being posted before the authentication was attached. My Authentication credentials were set up in the .env file like they are supposed to be. In order to get the 200 Status Success messages I had to hardcode my username and password into the config/mail.php file.

    Is there a way around this? I wouldn't want to explicitly code the authentication information in the config/mail.php file. Isn't that the whole point in placing it in the .env file? I was wondering why the authentication info was arriving last, which SendGrid told me was causing them to respond with a 550 error.

    4th February, 2015

    artmonger left a reply on Rejoice. L5 Si Here. • 2 years ago

    Surreal!

    Edit Your Profile
    Update

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