Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel update where

User::where('id', $user_id)
    ->update([
           'name' => $name
    ]);
Comment

laravel update

Model::where('id',1)->update(['name'=>'updated name']);
//or
$data         = Model::findOrFail($id); //primary id
$data->name   = $request->input('updated name');
$data->save();
Comment

laravel update model from request

public function update(Request $request, Teacher $teacher)
{
    $teachers = $request->all();
    $teacher->save();
    return back()->with('message', 'Record Successfully Updated!');
}
Comment

laravel create or update eloquesnt

$flight = AppFlight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99, 'discounted' => 1]
);
// updates price and discounted or creates a new record
Comment

laravel update model from request

public function update(Request $request, Teacher $teacher)
{
    $input = $request->all();
    $teacher->fill($input)->save();
    return back()->with('message', 'Record Successfully Updated!');
}
Comment

update laravel

use AppModelsFlight;

$flight = Flight::find(1);

$flight->name = 'Paris to London';

$flight->save();
Comment

laravel update model from request

public function update(Request $request, $id)
    {
        $supplier = SupplierModel::findOrFail($id);
        $supplier->update($request->all());
        return redirect(route('admin.suppliers.index'))->with('message', 'Поставщик успешно обновлен');
    }
Comment

laravel update

User::query()->whereId($user->id)
  ->update([
    	'column' => 'value',
    	'n' => 'n',
    ]);
Comment

laravel update

$flight = AppModelsFlight::find(1);

$flight->name = 'New Flight Name';

$flight->save();
Comment

laravel update method

 public function update(UpdatePostRequest $request, Post $post)
    {
        $request->validate([
        //unique:table,column,id
        "title" => "required|unique:posts,title,".$this->route('post')->id."|min:5",
        "description" => "required|min:15",
        "cover" => "nullable|file|mimes:jpeg,png|max:5000"
        ]);

        $post->title = $request->title;
        $post->slug = Str::slug($request->title);
        $post->description = $request->description;
        $post->excerpt = Str::words($request->description,50);

        if($request->hasFile('cover')){

//            delete old cover
            Storage::delete("public/cover/".$post->cover);

//            upload new cover
            $newName = "cover_".uniqid()."_".$request->file('cover')->extension();
            $request->file('cover')->storeAs("public/cover",$newName);

//            save to table
                $post->cover = $newName;
        }

            $post->update();

        return redirect()->route('post.detail',$post->slug)->with('status','Post Updated');
    }
Comment

laravel update

<form action="{{route('blog.update',$blog[0]->id)}}" method="post">
  @csrf 
  @method('PUT')
  <textarea  name="txtTitle" > 
   {{$blog[0]->title}}
  </textarea> 
  <input type="submit" value="Update" />
</form>
Comment

update function laravel 7

## View 
Route::get('/subjects', 'SubjectsController@index')->name('subjects');

## Create
Route::get('/subjects/create', 'SubjectsController@create')->name('subjects.create');
Route::post('/subjects/store', 'SubjectsController@store')->name('subjects.store');

## Update
Route::get('/subjects/store/{id}', 'SubjectsController@edit')->name('subjects.edit');
Route::post('/subjects/update/{id}', 'SubjectsController@update')->name('subjects.update');

## Delete
Route::get('/subjects/delete/{id}', 'SubjectsController@destroy')->name('subjects.delete');
Comment

PREVIOUS NEXT
Code Example
Php :: wordpress theme basics including CSS and js 
Php :: while loop laravel 
Php :: delete laravel error log 
Php :: set border phpoffice phpexcel 
Php :: curlopt_postfields php example 
Php :: php enablem mod 
Php :: find total value from cart in laravel 
Php :: php get highest value in multidimensional array 
Php :: wp wordPress variables de session 
Php :: count array index foreach in php 
Php :: php iframe add content 
Php :: php unset by value 
Php :: send data with window.location.href 
Php :: laravel 6 use username instead of id 
Php :: laravel set timezone dynamically 
Php :: symfony twig variable 
Php :: yajra datatables html column bulder example 
Php :: SIMPLE linked list in php 
Php :: function to find the mod of a number in php 
Php :: strpos() expects parameter 1 to be string, object given 
Php :: route list laravel 8 
Php :: str_contains — Determine if a string contains a given substring 
Php :: how do i use php read excel file 
Php :: wordpress basic auth 
Php :: input if not null laravel 
Php :: drop column laravel migration 
Php :: how to store wp editor in wordpress 
Php :: upload image in laravel 8 store in database and folder 
Php :: optional route parameter in laravel 
Php :: Export database to sql dump in php 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =