crud de canales de venta y sectores

This commit is contained in:
2021-07-12 10:23:15 -04:00
parent 6eba4aa52b
commit 4f1dfd1221
8 changed files with 228 additions and 11 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Models;
use App\Traits\UuidPrimaryKey;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
@@ -10,6 +11,13 @@ class Sector extends Model {
use UuidPrimaryKey, SoftDeletes;
protected $table = 'sectores';
protected $fillable = ['id', 'nombre', 'restaurante_id'];
public static function findOrFail($id) {
$sector = Sector::find($id);
if(!$sector) throw new ModelNotFoundException("sector", $id);
return $sector;
}
public function restaurante() {
return $this->belongsTo(Restaurante::class);