So I have a model, Post that has no methods defined within it.
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use DB;
class Post extends Model
{
}
From a controller, I make calls to that model like:
return view('pages.post', ['post' => Post::where('url_route', '=', $url_route)->first()]
This works fine, but I now want to format the date column that is returned from that request, every time that model is called. Is there a way to modify the returned array without defining a new method?
I am new to Laravel to thanks for the help. Just trying to figure out the most efficient way of doing things within the framework...
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire