lundi 27 novembre 2017

Laravel - Request slug = channel_name in lower case

I made a form which inserts new channels in the database and the slug equals the name of the channel but lowercase and without spaces. How can I achieve that in my code? This the controller it is going through:

 public function makeChannel(Request $request, Channel $channel) {
    $channel->channel_name = $request->channel_name;
    $channel->slug = $request->channel_name;
    $channel->save();

    return back()->with('flash', 'Het kanaal is aangemaakt');
}

The code works fine there are no problems but in the code above the slug just equals the channel_name. But can I achieve the above?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zJQR9y
via IFTTT

Aucun commentaire:

Enregistrer un commentaire