小编Paw*_*gol的帖子

如何从laravel 5.1中的数据库表的created_at属性中选择年份和月份?

我的问题是我想从created_at每年和每月的属性中获取数据库表中的数据.我试过的代码是:

$post= Mjblog::select(DB::raw('YEAR(created_at) year, MONTH(created_at) month'));
$posts_by_y_m = $post->where('created_at',$post)->get();
Run Code Online (Sandbox Code Playgroud)

php sql laravel eloquent laravel-5.1

15
推荐指数
3
解决办法
4万
查看次数

file_put_content ...无法打开流:Laravel 5中的权限被拒绝

错误在下面提到: -

ErrorException in Filesystem.php line 81:
   file_put_contents(/var/www/html/Training-management-system/storage/framework/views/bcb68ba8b65b7fabca5fe88709fb00b6): failed to open stream: Permission denied
Run Code Online (Sandbox Code Playgroud)

我可以谷歌但不能得到确切的解决方案.所以,如果有人帮我解决,我感激不尽.

php laravel

7
推荐指数
2
解决办法
3万
查看次数

如何减少默认bootstrap图标glyphicon glyphicon-chevron-right的厚度?

我尝试使用图标glyphicon glyphicon-chevron-right来显示我的设计方向但我需要一些比默认大小更薄的.那么如何减少glyphicon glyphicon-chevron-right的默认bootstrap图标的厚度我的代码是: -

  <div style="color:#FFF;">
       <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
  </div>
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap

6
推荐指数
1
解决办法
6619
查看次数

set_value不适用于Codeigniter上的输入类型文件

我正在为我的项目使用HMVC Codeigniter模式.在我的项目中,我需要在表单上设置值,其中输入类型的字段是file.So,我觉得很有帮助我解决这个问题的人.

我的控制器是test.php

<?php
class Test extends Controller{
function __construct(){
        parent::__construct();  

    }
function index(){

redirect('test/form');


}
  function form(){
        $this->load->library('form_validation');
        $this->load->helper('url');
        $this->form_validation->set_rules('fname','First Name','required|trim');
        $this->form_validation->set_rules('mname','Middle Name','required|trim');
        $this->form_validation->set_rules('lname','Last Name','required|trim');


        if (empty($_FILES['userfile']['name']))
        {
            $this->form_validation->set_rules('userfile', 'Attach Your File', 'required');
        }
        if($this->form_validation->run($this)){

                    $_SESSION['msg']="Your form has been submitted succesfully!!";
                    redirect('test/form');
                }
                else
                {

                    $_SESSION['err']="Opp! There was some wrong to fill up a form so try again!!!";
                    redirect('test/form');


                }

            }
        $data['pgtitle']='Test';       
        $this->load->view('test',$data);
        } 
}
Run Code Online (Sandbox Code Playgroud)

我的视图文件是test.php

<form action="<?php echo site_url()?>test/form" method="post" enctype="multipart/form-data" onsubmit="return confirm('Do you really want to submit …
Run Code Online (Sandbox Code Playgroud)

php codeigniter

5
推荐指数
1
解决办法
3705
查看次数

在Laravel 5.1中无法将Illuminate \ Database \ Eloquent \ Builder类的对象转换为字符串

我正在谷歌搜索并尝试表单nxt两天,它尝试对其进行调试,因此从表中获取数据ID的代码是:

$term=category::get(['id']);
Run Code Online (Sandbox Code Playgroud)

使用该$ varibale按id作为外键从数据库获取数据,其代码如下:-

$categories = HelpCenter::whereHas('category', function($category) use ($term)
{
    $category->where('category_id','=',$category);
})
  ->take(5)->get();
Run Code Online (Sandbox Code Playgroud)

php laravel

3
推荐指数
1
解决办法
4万
查看次数

标签 统计

php ×4

laravel ×3

codeigniter ×1

css ×1

eloquent ×1

html ×1

laravel-5.1 ×1

sql ×1

twitter-bootstrap ×1