skip to Main Content

How do I update data in the database in laravel?

This is the code I have written so far: Here is my Controller that contains the edit and update function: public function edit($id){ $post = Posts::find($id); return view('edit', compact('post')); } public function update(Request $request, $id){ $post = Posts::find($id); $validatedRequests =…

VIEW QUESTION

Auth – get model – Laravel

After using the IlluminateAuthAuthenticatable trait on a model, I can now do Auth::id() in places in my app (when the current auth-ed thing is that particular model). Is there a way to get the class / type of the auth-ed…

VIEW QUESTION

sql query last_messages displays wrong message – Laravel

i have query like this, but displays wrong last_message. $users = Message::join('users', function ($join) { $join->on('messages.from_id', '=', 'users.id') ->orOn('messages.to_id', '=', 'users.id'); }) ->where(function ($q) { $q->where('messages.from_id', auth()->user()->id) ->orWhere('messages.to_id', auth()->user()->id); }) ->where('users.id','!=',auth()->user()->id) ->select([ 'users.id', 'users.name', 'users.avatar', DB::raw('MAX(messages.created_at) max_created_at'), DB::raw('MAX(messages.body) last_message'), DB::raw('CASE…

VIEW QUESTION

Flickity AsNavFor producing error in the console: "Uncaught TypeError: Cannot read properties of undefined (reading 'create')" – Laravel

i'm using flickity as the instructions, but got this error warning in the console anybody know how to solve this? Here is the current bundle package <script src="https://unpkg.com/flickity-as-nav-for@3/as-nav-for.js"></script> <script src="https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js"></script> <link rel="stylesheet" href="https://unpkg.com/flickity@2/dist/flickity.min.css"> i'm using flickity AsNavFor but it shown…

VIEW QUESTION
Back To Top
Search