skip to Main Content

make a query with conditions in laravel

i wanna get the reservations that their status aren't canceled or if status is canceled it check they have unread messages or not Can you help me? class Reservation extends Model { public function unreadMessages() { return $this->hasMany(Message::class, 'reservation_id', 'id')…

VIEW QUESTION

Refreshing tymon/jwt-auth token in Laravel API

I have a Laravel API which i have installed tymon/jwt-auth into ... To log the user in and get a token, im using the following; if (! $token = auth()->attempt($request->only('email', 'password'), true)) { throw ValidationException::withMessages([ 'email' => 'Invalid Credentials', ]);…

VIEW QUESTION

Laravel controller not redirecting even submitted post data

CategoryController class CategoryController extends Controller { public function index(Request $request){ // $data['categories'] = $categories; $categories = Category::where([ ['name', '!=', Null], [function ($query) use ($request) { if (($keyword = $request->keyword)) { $query->orWhere('name', 'LIKE', '%' . $keyword . '%') ->get(); } }]…

VIEW QUESTION
Back To Top
Search