Modifica delle route per i tags

This commit is contained in:
2023-05-30 10:59:36 +02:00
parent 51b0d71204
commit 6f16876a69
5 changed files with 31 additions and 18 deletions

View File

@@ -9,28 +9,35 @@ use Illuminate\Support\Facades\DB;
class tag extends Model
{
use HasFactory;
public static function getList() {
return DB::table('tags')->orderBy('tag_name')->get();
return DB::table('tags')->orderBy('tag_name')->get();
}
public static function inserisci($param) {
DB::table('tags')->insert(['tag_name'=> $param['tag_name']]);
}
public static function getById($param) {
return DB::table('tags')
->where('tags.id','=',$param)
->get();
}
public static function updateById($param) {
DB::table('tags')
->where('id','=', $param['id'])
->update([
'tag_name' => $param['tag_name'],
]);
}
public static function delete($id)
{
DB::table('tags')
->where('id','=',$id)
->delete();
}
}