| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\Validator;
- class Asset extends Model
- {
- use HasFactory;
-
- /**
- * The database table used by the model.
- *
- * @var string
- */
- protected $table = 'assets';
- /**
- * The database primary key value.
- *
- * @var string
- */
- protected $primaryKey = 'id';
- /**
- * Attributes that should be mass-assignable.
- *
- * @var array
- */
- protected $fillable = [
- 'vendor_id',
- 'category_id',
- 'name',
- 'model_name',
- 'model_number',
- 'registered_number',
- 'brand',
- 'duration',
- 'asset_type',
- 'cost',
- 'description',
- 'image',
- 'weight',
- 'size',
- 'return_policy',
- 'status',
- 'meta_keyword',
- 'meta_description',
- 'created_by',
- ];
- public function validate($request){
- $validate = Validator::make($request->all(), [
- 'name' => 'required',
- 'cost' => 'required',
- ]);
- if($validate->fails()){
- return response()->json([
- 'status' => false,
- 'message' => 'Validation errors in your request',
- 'errors' => $validate->errors()
- ], 400);
- }
- return response()->json([
- 'status' => true,
- 'message' => 'sucess',
- 'errors' => ''
- ], 200);
- }
- }
|