Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel eloquent delete

User::where('id',$id)->delete();
//or
$user = User::find(1);
$user->delete();
Comment

laravel eloquent remove from db

$res=User::where('id',$id)->delete();
Comment

Laravel eloquent delete

use AppModelsFlight;

$flight = Flight::find(1);

$flight->delete();
Comment

laravel eloquent remove from db

public function destroy($id){

  $res=User::find($id)->delete();
  if ($res){
    $data=[
    'status'=>'1',
    'msg'=>'success'
  ];
  }else{
    $data=[
    'status'=>'0',
    'msg'=>'fail'
  ];
  return response()->json($data);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel realation with has 
Php :: laravel compare date timestamp 
Php :: wordpress display menu by name 
Php :: phpmyadmin centos 8 
Php :: php excel to array 
Php :: get value from url in laravel blade 
Php :: change the method name in resource in laravel 
Php :: factory laravel laravel 8 tinker 
Php :: config file php 
Php :: check if checkbox is not checked laravel 8 
Php :: json to html php table 
Php :: laravel get data from request 
Php :: how to merge 2 laravel eloquent records 
Php :: 413 error laravel 
Php :: check if post exists by id wordpress 
Php :: move uploaded file in php 
Php :: laravel swagger install 
Php :: php cookies 
Php :: laravel update email unique 
Php :: wc create new category 
Php :: Round the number in php 
Php :: how to set up the laravel ssh keygen 
Php :: why we use .htaccess file in php 
Php :: laravel blade global variable 
Php :: get cookie in laravel 
Php :: job with queue name in laravel 
Php :: create model, controller and migration in single command laravel 
Php :: enum in migration laravel 
Php :: update query laravel 
Php :: laravel notification attach file 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =