1 | <?php namespace Arcanedev\LaravelSeo\Models; |
||
21 | class Redirect extends AbstractModel |
||
22 | { |
||
23 | /* ----------------------------------------------------------------- |
||
24 | | Properties |
||
25 | | ----------------------------------------------------------------- |
||
26 | */ |
||
27 | /** |
||
28 | * The attributes that are mass assignable. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $fillable = ['old_url', 'new_url', 'status']; |
||
33 | |||
34 | /** |
||
35 | * The attributes that should be cast to native types. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $casts = [ |
||
40 | 'status' => 'integer', |
||
41 | ]; |
||
42 | |||
43 | /* ----------------------------------------------------------------- |
||
44 | | Constructor |
||
45 | | ----------------------------------------------------------------- |
||
46 | */ |
||
47 | /** |
||
48 | * Meta constructor. |
||
49 | * |
||
50 | * @param array $attributes |
||
51 | */ |
||
52 | 6 | public function __construct(array $attributes = []) |
|
58 | |||
59 | /* ----------------------------------------------------------------- |
||
60 | | Getters & Setters |
||
61 | | ----------------------------------------------------------------- |
||
62 | */ |
||
63 | /** |
||
64 | * Get the `status_name` attribute. |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | 3 | public function getStatusNameAttribute() |
|
72 | |||
73 | /* ----------------------------------------------------------------- |
||
74 | | Main Methods |
||
75 | | ----------------------------------------------------------------- |
||
76 | */ |
||
77 | /** |
||
78 | * Create a redirect url. |
||
79 | * |
||
80 | * @param string $oldUrl |
||
81 | * @param string $newUrl |
||
82 | * @param int $status |
||
83 | * |
||
84 | * @return \Arcanedev\LaravelSeo\Models\Redirect |
||
85 | */ |
||
86 | 6 | public static function createOne($oldUrl, $newUrl, $status = Response::HTTP_MOVED_PERMANENTLY) |
|
98 | } |
||
99 |