Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pelicula::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'precio' => $this->precio, 'duracion_minutos' => $this->duracion_minutos]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'estado', $this->estado]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $pelicula = Pelicula::find($id);
     if (is_null($pelicula)) {
         return response()->json('No econtrada');
     }
     $pelicula->delete();
     return response()->json('Eliminado');
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPelicula()
 {
     return $this->hasOne(Pelicula::className(), ['id' => 'peliculaid']);
 }
Esempio n. 4
0
});
Route::group(['prefix' => 'mantenedor'], function () {
    Route::get('pelicula', function () {
        return view('pelicula.lista');
    });
    Route::get('pelicula/crear', function () {
        JavaScript::put(['productoras' => \App\Models\Productora::all(['id', 'nombre']), 'actores' => \App\Models\Actor::all(['id', 'nombre'])]);
        return view('pelicula.crear');
    });
    Route::get('pelicula/{peliculaID}/editar', function ($peliculaID) {
        $pelicula = \App\Models\Pelicula::with('actores')->find($peliculaID);
        JavaScript::put(['pelicula' => $pelicula, 'productoras' => \App\Models\Productora::all(['id', 'nombre']), 'actores' => \App\Models\Actor::all(['id', 'nombre'])]);
        return view('pelicula.editar');
    });
    Route::get('pelicula/{peliculaID}/eliminar', function ($peliculaID) {
        $pelicula = \App\Models\Pelicula::with('actores')->find($peliculaID);
        JavaScript::put(['pelicula' => $pelicula, 'productoras' => \App\Models\Productora::all(['id', 'nombre']), 'actores' => \App\Models\Actor::all(['id', 'nombre'])]);
        return view('pelicula.eliminar');
    });
});
Route::get('img/{imgName}', 'Imagen\\ImagenController@show');
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', ['as' => 'auth/login', 'uses' => 'Auth\\AuthController@postLogin']);
Route::get('auth/logout', ['as' => 'auth/logout', 'uses' => 'Auth\\AuthController@getLogout']);
// Registration routes...
Route::get('auth/register', 'Auth\\AuthController@getRegister');
Route::post('auth/register', ['as' => 'auth/register', 'uses' => 'Auth\\AuthController@postRegister']);
Route::group(['prefix' => 'api'], function () {
    Route::get('pelicula', 'Pelicula\\PeliculaController@index');
    Route::post('pelicula', 'Pelicula\\PeliculaController@store');
Esempio n. 5
0
 public function getNombrePelicula()
 {
     $pelicula = Pelicula::find()->where(['id' => $this->personaid])->one();
     return $pelicula->getNombreCompleto();
 }
 /**
  * Finds the Pelicula model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Pelicula the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Pelicula::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 7
0
/* @var $this yii\web\View */
/* @var $model app\models\Actorpelicula */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="actorpelicula-form">

    <?php 
$form = ActiveForm::begin();
?>
	<?php 
echo $form->field($model, 'actorid')->dropDownList(ArrayHelper::map(Actor::find()->all(), 'id', 'nombres'), ['prompt' => 'Seleccionar actor', 'style' => 'width:300px']);
?>
    
<?php 
echo $form->field($model, 'peliculaid')->dropDownList(ArrayHelper::map(Pelicula::find()->all(), 'id', 'nombre'), ['prompt' => 'Seleccionar pelicula', 'style' => 'width:300px']);
?>
   

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Esempio n. 8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Pelicula::create(['titulo' => 'Pulp Fiction', 'desc' => 'Jules y Vincent, dos asesinos a sueldo con no demasiadas luces, trabajan para el gángster Marsellus Wallace. Vincent le confiesa a Jules que Marsellus le ha pedido que cuide de Mia, su atractiva mujer. Jules le recomienda prudencia porque es muy peligroso sobrepasarse con la novia del jefe. Cuando llega la hora de trabajar, ambos deben ponerse "manos a la obra". Su misión: recuperar un misterioso maletín. (FILMAFFINITY)', 'copias' => 10, 'productora_id' => 1]);
 }