Answers for "eloquent raw sql query"

PHP
1

raw queries in laravel

DB::statement('UPDATE users SET role_id = 1 WHERE role_id IS NULL AND YEAR(created_at) > 2020');
Posted by: Guest on August-11-2020
4

TRANSACTON LARAVEL QUERY BUILDER

DB::beginTransaction();

try {
    DB::insert(...);    
    DB::commit();
} catch (\Throwable $e) {
    DB::rollback();
    throw $e;
}
Posted by: Guest on September-22-2020
0

eloquent where raw

$query->whereRaw("(
        LOWER(name)             like '%". strtolower($search) ."%' OR
        LOWER(sku)              like '%". strtolower($search) ."%' OR
        LOWER(codigo)           like '%". strtolower($search) ."%' OR
        LOWER(descricao_curta)  like '%". strtolower($search) ."%'
    )");
Posted by: Guest on August-20-2021
0

Writing into the database with one click laravel

<form action="{{ route('signup') }}" method="post">
    <button type="submit"> submit </button>
</form>
Posted by: Guest on October-23-2020

Browse Popular Code Answers by Language